Handle "Move" activity
This commit is contained in:
parent
4270861085
commit
61fc739ab8
7 changed files with 146 additions and 0 deletions
|
|
@ -107,4 +107,28 @@ defmodule Pleroma.FollowingRelationship do
|
|||
[user.follower_address | following]
|
||||
end
|
||||
end
|
||||
|
||||
def move_following(origin, target) do
|
||||
following_relationships =
|
||||
__MODULE__
|
||||
|> where(following_id: ^origin.id)
|
||||
|> preload([:follower])
|
||||
|> limit(50)
|
||||
|> Repo.all()
|
||||
|
||||
case following_relationships do
|
||||
[] ->
|
||||
:ok
|
||||
|
||||
following_relationships ->
|
||||
Enum.each(following_relationships, fn following_relationship ->
|
||||
Repo.transaction(fn ->
|
||||
Repo.delete(following_relationship)
|
||||
User.follow(following_relationship.follower, target)
|
||||
end)
|
||||
end)
|
||||
|
||||
move_following(origin, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue