+
+ def get_followers(%Hashtag{id: hashtag_id}) do
+ from(hf in HashtagFollow)
+ |> where([hf], hf.hashtag_id == ^hashtag_id)
+ |> join(:inner, [hf], u in assoc(hf, :user))
+ |> select([hf, u], u.id)
+ |> Repo.all()
+ end
+
+ def get_recipients_for_activity(%Pleroma.Activity{object: %{hashtags: tags}})
+ when is_list(tags) do
+ tags
+ |> Enum.map(&get_followers/1)
+ |> List.flatten()
+ |> Enum.uniq()
+ end
+
+ def get_recipients_for_activity(_activity), do: []