mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
activitypub: use Object.delete() instead of mutating the database and cache directly
This commit is contained in:
parent
c4e43da63e
commit
2bf358d7b4
2 changed files with 2 additions and 4 deletions
|
@ -273,8 +273,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
"to" => [user.follower_address, "https://www.w3.org/ns/activitystreams#Public"]
|
||||
}
|
||||
|
||||
with Repo.delete(object),
|
||||
Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)),
|
||||
with Object.delete(object),
|
||||
{:ok, activity} <- insert(data, local),
|
||||
:ok <- maybe_federate(activity),
|
||||
{:ok, _actor} <- User.decrease_note_count(user) do
|
||||
|
|
|
@ -9,8 +9,7 @@ defmodule Pleroma.Web.CommonAPI do
|
|||
with %Activity{data: %{"object" => %{"id" => object_id}}} <- Repo.get(Activity, activity_id),
|
||||
%Object{} = object <- Object.normalize(object_id),
|
||||
true <- user.info["is_moderator"] || user.ap_id == object.data["actor"],
|
||||
{:ok, delete} <- ActivityPub.delete(object),
|
||||
{:ok, true} <- Cachex.del(:user_cache, "object:#{object_id}") do
|
||||
{:ok, delete} <- ActivityPub.delete(object) do
|
||||
{:ok, delete}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue