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:
commit
33587f5cb4
|
@ -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