Store private announcements in object.data["announcements"], filter them on display
This commit is contained in:
parent
43e3db0951
commit
427d0c2a00
3 changed files with 32 additions and 3 deletions
|
|
@ -242,7 +242,19 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
|||
def reblogged_by(%{assigns: %{user: user}} = conn, %{"id" => id}) do
|
||||
with %Activity{} = activity <- Activity.get_by_id_with_object(id),
|
||||
{:visible, true} <- {:visible, Visibility.visible_for_user?(activity, user)},
|
||||
%Object{data: %{"announcements" => announces}} <- Object.normalize(activity) do
|
||||
%Object{data: %{"announcements" => announces, "id" => ap_id}} <-
|
||||
Object.normalize(activity) do
|
||||
announces =
|
||||
"Announce"
|
||||
|> Activity.Queries.by_type()
|
||||
|> Ecto.Query.where([a], a.actor in ^announces)
|
||||
# this is to use the index
|
||||
|> Activity.Queries.by_object_id(ap_id)
|
||||
|> Repo.all()
|
||||
|> Enum.filter(&Visibility.visible_for_user?(&1, user))
|
||||
|> Enum.map(& &1.actor)
|
||||
|> Enum.uniq()
|
||||
|
||||
users =
|
||||
User
|
||||
|> Ecto.Query.where([u], u.ap_id in ^announces)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue