parent
5c573a8a28
commit
cd8bdbc761
2 changed files with 17 additions and 3 deletions
|
@ -362,11 +362,10 @@ defmodule Pleroma.Activity do
|
||||||
end
|
end
|
||||||
|
|
||||||
def restrict_deactivated_users(query) do
|
def restrict_deactivated_users(query) do
|
||||||
deactivated_users =
|
deactivated_users_query =
|
||||||
from(u in User.Query.build(%{deactivated: true}), select: u.ap_id)
|
from(u in User.Query.build(%{deactivated: true}), select: u.ap_id)
|
||||||
|> Repo.all()
|
|
||||||
|
|
||||||
Activity.Queries.exclude_authors(query, deactivated_users)
|
from(activity in query, where: activity.actor not in subquery(deactivated_users_query))
|
||||||
end
|
end
|
||||||
|
|
||||||
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search
|
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search
|
||||||
|
|
|
@ -776,6 +776,21 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
||||||
assert Enum.member?(activities, activity_one)
|
assert Enum.member?(activities, activity_one)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "doesn't return activities from deactivated users" do
|
||||||
|
_user = insert(:user)
|
||||||
|
deactivated = insert(:user)
|
||||||
|
active = insert(:user)
|
||||||
|
{:ok, activity_one} = CommonAPI.post(deactivated, %{status: "hey!"})
|
||||||
|
{:ok, activity_two} = CommonAPI.post(active, %{status: "yay!"})
|
||||||
|
{:ok, _updated_user} = User.set_activation(deactivated, false)
|
||||||
|
|
||||||
|
activities = ActivityPub.fetch_activities([], %{})
|
||||||
|
|
||||||
|
refute Enum.member?(activities, activity_one)
|
||||||
|
assert Enum.member?(activities, activity_two)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
test "always see your own posts even when they address people you block" do
|
test "always see your own posts even when they address people you block" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
blockee = insert(:user)
|
blockee = insert(:user)
|
||||||
|
|
Loading…
Reference in a new issue