diff options
author | sxsdv1 <sxsdv1@gmail.com> | 2019-01-01 23:19:40 +0100 |
---|---|---|
committer | sxsdv1 <sxsdv1@gmail.com> | 2019-01-01 23:20:43 +0100 |
commit | 4e1cc2bab6ec76af1b6de986561a82887d18f366 (patch) | |
tree | aa04ba4a3fd68e9bce3e5472b60db2059a26ee7a /lib | |
parent | 551c3d9391c0eeb282d750979b8eef5025c41482 (diff) | |
download | pleroma-4e1cc2bab6ec76af1b6de986561a82887d18f366.tar.gz |
Implement delete activity
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub_controller.ex | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index d23c54933..a3f736fee 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -181,6 +181,16 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do }) end + def handle_user_activity(user, %{"type" => "Delete"} = params) do + with %Object{} = object <- Object.normalize(params["object"]), + true <- user.info.is_moderator || user.ap_id == object.data["actor"], + {:ok, delete} <- ActivityPub.delete(object) do + {:ok, delete} + else + _ -> {:error, "Can't delete object"} + end + end + def handle_user_activity(_, _) do {:error, "Unhandled activity type"} end |