Allow moderators to delete posts.

This commit is contained in:
lain 2018-02-20 18:54:13 +01:00
parent 5bc810c452
commit eec6a87dbb
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ defmodule Pleroma.Web.CommonAPI do
def delete(activity_id, user) do def delete(activity_id, user) do
with %Activity{data: %{"object" => %{"id" => object_id}}} <- Repo.get(Activity, activity_id), with %Activity{data: %{"object" => %{"id" => object_id}}} <- Repo.get(Activity, activity_id),
%Object{} = object <- Object.get_by_ap_id(object_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} <- ActivityPub.delete(object) do
{:ok, delete} {:ok, delete}
end end