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