fix(context): show local-only replies to local users

Ported from Akkoma 7869030e0.

Co-authored-by: Oneric <oneric@oneric.stub>
This commit is contained in:
Lain Soykaf 2026-10-31 13:43:59 +04:00
commit b486a84fef
No known key found for this signature in database
3 changed files with 38 additions and 6 deletions

View file

@ -466,21 +466,28 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
def fetch_activities_for_context_query(context, opts) do
public = [Constants.as_public()]
user = opts[:user]
recipients =
if opts[:user],
do: [opts[:user].ap_id | User.following(opts[:user])] ++ public,
else: public
cond do
user && user.local ->
[Constants.as_public(), as_local_public(), user.ap_id | User.following(user)]
user ->
[Constants.as_public(), user.ap_id | User.following(user)]
true ->
[Constants.as_public()]
end
from(activity in Activity)
|> maybe_preload_objects(opts)
|> maybe_preload_bookmarks(opts)
|> maybe_set_thread_muted_field(opts)
|> restrict_unauthenticated(opts[:user])
|> restrict_unauthenticated(user)
|> restrict_blocked(opts)
|> restrict_blockers_visibility(opts)
|> restrict_recipients(recipients, opts[:user])
|> restrict_recipients(recipients, user)
|> restrict_filtered(opts)
|> where(
[activity],