From dcadde5e37e95318e6bfbe0af11af6670874c747 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 25 Aug 2021 23:30:22 -0400 Subject: [PATCH] Fix federating to followers --- lib/clacks/activitypub/federator.ex | 2 +- lib/clacks/user_actions_helper.ex | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/clacks/activitypub/federator.ex b/lib/clacks/activitypub/federator.ex index a8a2837..36cc207 100644 --- a/lib/clacks/activitypub/federator.ex +++ b/lib/clacks/activitypub/federator.ex @@ -18,7 +18,7 @@ defmodule Clacks.ActivityPub.Federator do addressed_actors = if actor.data["followers"] in addressed do addressed = List.delete(addressed, actor.data["followers"]) - [actor.followers | addressed] + actor.followers ++ addressed else addressed end diff --git a/lib/clacks/user_actions_helper.ex b/lib/clacks/user_actions_helper.ex index 4eda348..faa0d1e 100644 --- a/lib/clacks/user_actions_helper.ex +++ b/lib/clacks/user_actions_helper.ex @@ -48,12 +48,11 @@ defmodule Clacks.UserActionsHelper do end end - @spec get_addressed(String.t(), [{String.t(), Actor.t()}], String.t() | nil) :: + @spec get_addressed(User.t(), [{String.t(), Actor.t()}], String.t() | nil) :: {[String.t()], [String.t()]} - defp get_addressed(_author, mentions, in_reply_to_actor) do + defp get_addressed(author, mentions, in_reply_to_actor) do to = [@public | Enum.map(mentions, fn {_, actor} -> actor.ap_id end)] - # todo: followers - cc = [] + cc = [Repo.preload(author, :actor).actor.data["followers"]] to = case in_reply_to_actor do