Commit eec6a87d authored by lain's avatar lain
Browse files

Allow moderators to delete posts.

parent 5bc810c4
Pipeline #767 passed with stage
in 2 minutes and 17 seconds
......@@ -8,7 +8,7 @@ defmodule Pleroma.Web.CommonAPI do
def delete(activity_id, user) do
with %Activity{data: %{"object" => %{"id" => object_id}}} <- Repo.get(Activity, activity_id),
%Object{} = object <- Object.get_by_ap_id(object_id),
true <- user.ap_id == object.data["actor"],
true <- user.info["is_moderator"] || (user.ap_id == object.data["actor"]),
{:ok, delete} <- ActivityPub.delete(object) do
{:ok, delete}
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment