Allow updating accepted follow activities in Web.ActivityPub.Utils.update_follow_state_for_all/2

Mastodon uses the Reject activity also for the purpose of removing
a follower, in addition to reject a follow request. We should
also update the original Follow activity in this case.
This commit is contained in:
Tusooa Zhu 2021-12-17 14:17:51 -05:00
commit 3d41ccc47b
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
2 changed files with 15 additions and 1 deletions

View file

@ -446,7 +446,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|> Activity.Queries.by_type()
|> Activity.Queries.by_actor(actor)
|> Activity.Queries.by_object_id(object)
|> where(fragment("data->>'state' = 'pending'"))
|> where(fragment("data->>'state' = 'pending'") or fragment("data->>'state' = 'accept'"))
|> update(set: [data: fragment("jsonb_set(data, '{state}', ?)", ^state)])
|> Repo.update_all([])