Better handle deleted comments
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6f9db37ca3
commit
cfffe5b248
|
@ -37,6 +37,11 @@ defmodule Mobilizon.Federation.ActivityPub.Audience do
|
|||
%{"to" => maybe_add_group_members([], actor), "cc" => []}
|
||||
end
|
||||
|
||||
# Deleted comments are just like tombstones
|
||||
def get_audience(%Comment{deleted_at: deleted_at}) when not is_nil(deleted_at) do
|
||||
%{"to" => [@ap_public], "cc" => []}
|
||||
end
|
||||
|
||||
def get_audience(%Comment{discussion: %Discussion{} = discussion}) do
|
||||
get_audience(discussion)
|
||||
end
|
||||
|
|
|
@ -1110,6 +1110,10 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do
|
|||
{:error, error_message, object} when error_message in ["Gone", "Not found"] ->
|
||||
{:ok, object}
|
||||
|
||||
# comments are just emptied
|
||||
{:ok, %Comment{deleted_at: deleted_at} = object} when not is_nil(deleted_at) ->
|
||||
{:ok, object}
|
||||
|
||||
{:ok, %{url: url} = object} ->
|
||||
if Utils.are_same_origin?(url, Endpoint.url()),
|
||||
do: {:ok, object},
|
||||
|
|
Loading…
Reference in New Issue