Fix error when determining audience for Discussion

Closes #873

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-13 11:46:25 +01:00
parent b4bfa0856f
commit 18cd7c11f1
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -3,7 +3,7 @@ defmodule Mobilizon.Federation.ActivityPub.Audience do
Tools for calculating content audience Tools for calculating content audience
""" """
alias Mobilizon.{Actors, Events, Share} alias Mobilizon.{Actors, Discussions, Events, Share}
alias Mobilizon.Actors.{Actor, Member} alias Mobilizon.Actors.{Actor, Member}
alias Mobilizon.Discussions.{Comment, Discussion} alias Mobilizon.Discussions.{Comment, Discussion}
alias Mobilizon.Events.{Event, Participant} alias Mobilizon.Events.{Event, Participant}
@ -43,8 +43,10 @@ defmodule Mobilizon.Federation.ActivityPub.Audience do
%{"to" => [@ap_public], "cc" => []} %{"to" => [@ap_public], "cc" => []}
end end
def get_audience(%Comment{discussion: %Discussion{} = discussion}) do def get_audience(%Comment{discussion: %Discussion{id: discussion_id}}) do
get_audience(discussion) discussion_id
|> Discussions.get_discussion()
|> get_audience()
end end
def get_audience(%Comment{ def get_audience(%Comment{