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"]
|
"to" => [user.follower_address, "https://www.w3.org/ns/activitystreams#Public"]
|
||||||
}
|
}
|
||||||
|
|
||||||
with Repo.delete(object),
|
with Object.delete(object),
|
||||||
Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)),
|
|
||||||
{:ok, activity} <- insert(data, local),
|
{:ok, activity} <- insert(data, local),
|
||||||
:ok <- maybe_federate(activity),
|
:ok <- maybe_federate(activity),
|
||||||
{:ok, _actor} <- User.decrease_note_count(user) do
|
{: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),
|
with %Activity{data: %{"object" => %{"id" => object_id}}} <- Repo.get(Activity, activity_id),
|
||||||
%Object{} = object <- Object.normalize(object_id),
|
%Object{} = object <- Object.normalize(object_id),
|
||||||
true <- user.info["is_moderator"] || user.ap_id == object.data["actor"],
|
true <- user.info["is_moderator"] || user.ap_id == object.data["actor"],
|
||||||
{:ok, delete} <- ActivityPub.delete(object),
|
{:ok, delete} <- ActivityPub.delete(object) do
|
||||||
{:ok, true} <- Cachex.del(:user_cache, "object:#{object_id}") do
|
|
||||||
{:ok, delete}
|
{:ok, delete}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue