Merge branch 'features/add-credo-to-ci' into 'develop'
[akkoma] / lib / pleroma / web / ostatus / handlers / delete_handler.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.OStatus.DeleteHandler do
6 require Logger
7 alias Pleroma.Object
8 alias Pleroma.Web.ActivityPub.ActivityPub
9 alias Pleroma.Web.XML
10
11 def handle_delete(entry, _doc \\ nil) do
12 with id <- XML.string_from_xpath("//id", entry),
13 %Object{} = object <- Object.normalize(id),
14 {:ok, delete} <- ActivityPub.delete(object, false) do
15 delete
16 end
17 end
18 end