mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 07:52:43 +00:00
Better handle deleted comments
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
6f9db37ca3
commit
cfffe5b248
2 changed files with 9 additions and 0 deletions
|
@ -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 a new issue