[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:
Haelwenn (lanodan) Monnier 2018-11-01 06:52:01 +01:00
parent 3a8797e942
commit 558e6a84d6
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -9,7 +9,8 @@ def delete(activity_id, user) 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) do
{:ok, delete} <- ActivityPub.delete(object),
{:ok, true} <- Cachex.del(:user_cache, "object:#{object_id}") do
{:ok, delete}
end
end