Merge branch 'feature/move-activity' into 'develop'
Support "Move" activity Closes #1316 See merge request pleroma/pleroma!1883
This commit is contained in:
commit
7722e5a67a
24 changed files with 354 additions and 51 deletions
|
|
@ -107,4 +107,22 @@ defmodule Pleroma.FollowingRelationship do
|
|||
[user.follower_address | following]
|
||||
end
|
||||
end
|
||||
|
||||
def move_following(origin, target) do
|
||||
__MODULE__
|
||||
|> join(:inner, [r], f in assoc(r, :follower))
|
||||
|> where(following_id: ^origin.id)
|
||||
|> where([r, f], f.allow_following_move == true)
|
||||
|> limit(50)
|
||||
|> preload([:follower])
|
||||
|> Repo.all()
|
||||
|> Enum.map(fn following_relationship ->
|
||||
Repo.delete(following_relationship)
|
||||
Pleroma.Web.CommonAPI.follow(following_relationship.follower, target)
|
||||
end)
|
||||
|> case do
|
||||
[] -> :ok
|
||||
_ -> move_following(origin, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue