Deduplicate incoming followers

This commit is contained in:
Shadowfacts 2020-04-26 16:25:48 -04:00
parent e7dcbdc6a4
commit e0c8f8e142
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 2 additions and 1 deletions

View File

@ -42,7 +42,8 @@ defmodule Clacks.Inbox do
store_activity(activity)
changeset = Actor.changeset(followed, %{followers: [follower_id | followed.followers]})
new_followers = [follower_id | followed.followers] |> Enum.uniq()
changeset = Actor.changeset(followed, %{followers: new_followers})
case Repo.update(changeset) do
{:error, changeset} ->