fixes for tests
This commit is contained in:
parent
229ce6abbc
commit
85953c0836
3 changed files with 11 additions and 4 deletions
|
@ -280,7 +280,7 @@ def home_timeline(%{assigns: %{user: user}} = conn, params) do
|
|||
|> ActivityPub.contain_timeline(user)
|
||||
|> Enum.reverse()
|
||||
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> add_link_headers(:home_timeline, activities)
|
||||
|
|
|
@ -85,7 +85,12 @@ def render(
|
|||
|
||||
activity_object = Object.normalize(activity)
|
||||
favorited = opts[:for] && opts[:for].ap_id in (activity_object.data["likes"] || [])
|
||||
bookmarked = opts[:for] && activity_object.data["id"] in opts[:for].bookmarks
|
||||
|
||||
bookmarked =
|
||||
opts[:for] && Ecto.assoc_loaded?(opts[:for].bookmarks) &&
|
||||
Enum.any?(opts[:for].bookmarks, fn b ->
|
||||
b.activity_id == activity.id or b.activity.data["object"]["id"] == object
|
||||
end)
|
||||
|
||||
mentions =
|
||||
activity.recipients
|
||||
|
@ -150,7 +155,9 @@ def render("status.json", %{activity: %{data: %{"object" => _object}} = activity
|
|||
|
||||
bookmarked =
|
||||
opts[:for] && Ecto.assoc_loaded?(opts[:for].bookmarks) &&
|
||||
Enum.any?(opts[:for].bookmarks, fn b -> b.activity_id == activity.id end)
|
||||
Enum.any?(opts[:for].bookmarks, fn b ->
|
||||
b.activity_id == activity.id
|
||||
end)
|
||||
|
||||
attachment_data = object.data["attachment"] || []
|
||||
attachments = render_many(attachment_data, StatusView, "attachment.json", as: :attachment)
|
||||
|
|
|
@ -1022,7 +1022,7 @@ test "reblogged status for another user", %{conn: conn} do
|
|||
user2 = insert(:user)
|
||||
user3 = insert(:user)
|
||||
CommonAPI.favorite(activity.id, user2)
|
||||
{:ok, user2} = User.bookmark(user2, activity.data["object"]["id"])
|
||||
{:ok, _bookmark} = Pleroma.Bookmark.create(user2.id, activity.id)
|
||||
{:ok, reblog_activity1, _object} = CommonAPI.repeat(activity.id, user1)
|
||||
{:ok, _, _object} = CommonAPI.repeat(activity.id, user2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue