Return the corresponding object id in attachment view

This commit is contained in:
Tusooa Zhu 2022-06-08 11:45:24 -04:00
commit aafd7a687d
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
4 changed files with 48 additions and 4 deletions

View file

@ -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)