|> 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})
|> 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)
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})
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})
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})
%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)
%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)
ActivityPub.fetch_activities([], params)
|> Enum.reverse()
- user = Repo.preload(user, :bookmarks)
+ user = Repo.preload(user, bookmarks: :activity)
conn
|> add_link_headers(:favourites, activities)
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)
|> ActivityPub.fetch_activities_bounded(following, params)
|> Enum.reverse()
- user = Repo.preload(user, :bookmarks)
+ user = Repo.preload(user, bookmarks: :activity)
conn
|> put_view(StatusView)