Transmogrifier: On incoming follow accept, update follow counts.
This commit is contained in:
parent
b5b675fa14
commit
ec5e057802
2 changed files with 11 additions and 1 deletions
|
@ -544,6 +544,9 @@ def handle_incoming(
|
|||
{:ok, follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "accept"),
|
||||
%User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity.data["actor"]),
|
||||
{:ok, _relationship} <- FollowingRelationship.update(follower, followed, :follow_accept) do
|
||||
User.update_follower_count(followed)
|
||||
User.update_following_count(follower)
|
||||
|
||||
ActivityPub.accept(%{
|
||||
to: follow_activity.data["to"],
|
||||
type: "Accept",
|
||||
|
@ -553,7 +556,8 @@ def handle_incoming(
|
|||
activity_id: id
|
||||
})
|
||||
else
|
||||
_e -> :error
|
||||
_e ->
|
||||
:error
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1120,6 +1120,12 @@ test "it works for incoming accepts which are referenced by IRI only" do
|
|||
follower = User.get_cached_by_id(follower.id)
|
||||
|
||||
assert User.following?(follower, followed) == true
|
||||
|
||||
follower = User.get_by_id(follower.id)
|
||||
assert follower.following_count == 1
|
||||
|
||||
followed = User.get_by_id(followed.id)
|
||||
assert followed.follower_count == 1
|
||||
end
|
||||
|
||||
test "it fails for incoming accepts which cannot be correlated" do
|
||||
|
|
Loading…
Reference in a new issue