[Pleroma.Web.CommonAPI]: Delete post cache entry when it’s deleted
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 1 Nov 2018 05:52:01 +0000 (06:52 +0100)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 1 Nov 2018 05:52:01 +0000 (06:52 +0100)
Closes: https://git.pleroma.social/pleroma/pleroma/issues/346
lib/pleroma/web/common_api/common_api.ex

index 8f47bb12785aa0e12ee092473dfd36a46203b140..8607cb6b3010c4babf22f3c4cc94b7e5cef92746 100644 (file)
@@ -9,7 +9,8 @@ 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) do
+         {:ok, delete} <- ActivityPub.delete(object),
+         {:ok, true} <- Cachex.del(:user_cache, "object:#{object_id}") do
       {:ok, delete}
     end
   end