Broadcast deleted activity id on deletion to conform to MastoAPI streamig spec

This commit is contained in:
eugenijm 2019-03-09 14:12:15 +03:00
commit 6038c8a753
6 changed files with 40 additions and 14 deletions

View file

@ -107,6 +107,18 @@ defmodule Pleroma.Activity do
def get_in_reply_to_activity(_), do: nil
def delete_by_ap_id(id) when is_binary(id) do
by_object_ap_id(id)
|> Repo.delete_all(returning: true)
|> elem(1)
|> Enum.find(fn
%{data: %{"type" => "Create", "object" => %{"id" => ap_id}}} -> ap_id == id
_ -> nil
end)
end
def delete_by_ap_id(_), do: nil
for {ap_type, type} <- @mastodon_notification_types do
def mastodon_notification_type(%Activity{data: %{"type" => unquote(ap_type)}}),
do: unquote(type)