Add follow_requests_outstanding_since?/3 to Pleroma.Activity
This commit is contained in:
parent
f0dcc1ca69
commit
1926d0804b
|
@ -345,6 +345,20 @@ def following_requests_for_actor(%User{ap_id: ap_id}) do
|
||||||
|> Repo.all()
|
|> Repo.all()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def follow_requests_outstanding_since?(
|
||||||
|
%User{ap_id: follower_id},
|
||||||
|
%User{ap_id: followee_id},
|
||||||
|
since_datetime
|
||||||
|
) do
|
||||||
|
followee_id
|
||||||
|
|> Queries.by_object_id()
|
||||||
|
|> Queries.by_type("Follow")
|
||||||
|
|> where([a], a.inserted_at > ^since_datetime)
|
||||||
|
|> where([a], fragment("? ->> 'state' != 'accept'", a.data))
|
||||||
|
|> where([a], a.actor == ^follower_id)
|
||||||
|
|> Repo.exists?()
|
||||||
|
end
|
||||||
|
|
||||||
def restrict_deactivated_users(query) do
|
def restrict_deactivated_users(query) do
|
||||||
deactivated_users =
|
deactivated_users =
|
||||||
from(u in User.Query.build(%{deactivated: true}), select: u.ap_id)
|
from(u in User.Query.build(%{deactivated: true}), select: u.ap_id)
|
||||||
|
|
Loading…
Reference in New Issue