mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
test fixes
This commit is contained in:
parent
85953c0836
commit
a825056d4d
1 changed files with 13 additions and 7 deletions
|
@ -300,7 +300,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
|> ActivityPub.fetch_public_activities()
|
||||
|> Enum.reverse()
|
||||
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> add_link_headers(:public_timeline, activities, false, %{"local" => local_only})
|
||||
|
@ -337,7 +337,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
|> ActivityPub.fetch_activities_query(params)
|
||||
|> Pagination.fetch_paginated(params)
|
||||
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> add_link_headers(:dm_timeline, activities)
|
||||
|
@ -348,6 +348,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
def get_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||
with %Activity{} = activity <- Activity.get_by_id_with_object(id),
|
||||
true <- Visibility.visible_for_user?(activity, user) do
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|> try_render("status.json", %{activity: activity, for: user})
|
||||
|
@ -497,6 +499,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
def reblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
|
||||
with {:ok, announce, _activity} <- CommonAPI.repeat(ap_id_or_id, user),
|
||||
%Activity{} = announce <- Activity.normalize(announce.data) do
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|> try_render("status.json", %{activity: announce, for: user, as: :activity})
|
||||
|
@ -506,6 +510,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
def unreblog_status(%{assigns: %{user: user}} = conn, %{"id" => ap_id_or_id}) do
|
||||
with {:ok, _unannounce, %{data: %{"id" => id}}} <- CommonAPI.unrepeat(ap_id_or_id, user),
|
||||
%Activity{} = activity <- Activity.get_create_by_object_ap_id_with_object(id) do
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|> try_render("status.json", %{activity: activity, for: user, as: :activity})
|
||||
|
@ -556,7 +562,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
%User{} = user <- User.get_cached_by_nickname(user.nickname),
|
||||
true <- Visibility.visible_for_user?(activity, user),
|
||||
{:ok, _bookmark} <- Bookmark.create(user.id, activity.id) do
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|
@ -569,7 +575,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
%User{} = user <- User.get_cached_by_nickname(user.nickname),
|
||||
true <- Visibility.visible_for_user?(activity, user),
|
||||
{:ok, _bookmark} <- Bookmark.destroy(user.id, activity.id) do
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|
@ -1091,7 +1097,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
ActivityPub.fetch_activities([], params)
|
||||
|> Enum.reverse()
|
||||
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> add_link_headers(:favourites, activities)
|
||||
|
@ -1138,7 +1144,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
|
||||
def bookmarks(%{assigns: %{user: user}} = conn, params) do
|
||||
user = User.get_cached_by_id(user.id)
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
bookmarks =
|
||||
Bookmark.for_user_query(user.id)
|
||||
|
@ -1255,7 +1261,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||
|> ActivityPub.fetch_activities_bounded(following, params)
|
||||
|> Enum.reverse()
|
||||
|
||||
user = Repo.preload(user, :bookmarks)
|
||||
user = Repo.preload(user, bookmarks: :activity)
|
||||
|
||||
conn
|
||||
|> put_view(StatusView)
|
||||
|
|
Loading…
Reference in a new issue