Merge branch 'bugfix/caching-activity-delete' into 'develop'

[Pleroma.Web.CommonAPI]: Delete post cache entry when it’s deleted

Closes #346

See merge request pleroma/pleroma!407
This commit is contained in:
Haelwenn 2018-11-01 05:58:11 +00:00
commit 33587f5cb4

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