[Pleroma.Web.CommonAPI]: Delete post cache entry when it’s deleted
Closes: https://git.pleroma.social/pleroma/pleroma/issues/346
This commit is contained in:
parent
3a8797e942
commit
558e6a84d6
|
@ -9,7 +9,8 @@ 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.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) do
|
{:ok, delete} <- ActivityPub.delete(object),
|
||||||
|
{:ok, true} <- Cachex.del(:user_cache, "object:#{object_id}") do
|
||||||
{:ok, delete}
|
{:ok, delete}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue