Return the corresponding object id in attachment view
This commit is contained in:
parent
237b220d71
commit
aafd7a687d
4 changed files with 48 additions and 4 deletions
|
|
@ -2077,6 +2077,25 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
|||
assert response["spoiler_text"] == "lol"
|
||||
end
|
||||
|
||||
test "it updates the attachments", %{conn: conn, user: user} do
|
||||
attachment = insert(:attachment, user: user)
|
||||
attachment_id = to_string(attachment.id)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "mew mew #abc", spoiler_text: "#def"})
|
||||
|
||||
response =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> put("/api/v1/statuses/#{activity.id}", %{
|
||||
"status" => "mew mew #abc",
|
||||
"spoiler_text" => "#def",
|
||||
"media_ids" => [attachment_id]
|
||||
})
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert [%{"id" => ^attachment_id}] = response["media_attachments"]
|
||||
end
|
||||
|
||||
test "it does not update visibility", %{conn: conn, user: user} do
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{
|
||||
|
|
|
|||
|
|
@ -111,6 +111,18 @@ defmodule Pleroma.Factory do
|
|||
}
|
||||
end
|
||||
|
||||
def attachment_factory(attrs \\ %{}) do
|
||||
user = attrs[:user] || insert(:user)
|
||||
|
||||
data =
|
||||
attachment_data(user.ap_id, nil)
|
||||
|> Map.put("id", Pleroma.Web.ActivityPub.Utils.generate_object_id())
|
||||
|
||||
%Pleroma.Object{
|
||||
data: merge_attributes(data, Map.get(attrs, :data, %{}))
|
||||
}
|
||||
end
|
||||
|
||||
def attachment_note_factory(attrs \\ %{}) do
|
||||
user = attrs[:user] || insert(:user)
|
||||
{length, attrs} = Map.pop(attrs, :length, 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue