From 0199619fd90d12049fe24302cc2cc01c50ada28f Mon Sep 17 00:00:00 2001 From: BentiGorlich Date: Thu, 8 Aug 2024 21:44:00 +0000 Subject: [PATCH] Invalidate collection cache before getting collection for likes, dislikes and shares (#1008) --- src/Service/ActivityPubManager.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Service/ActivityPubManager.php b/src/Service/ActivityPubManager.php index c2eb61c0f..cc00ed3cc 100644 --- a/src/Service/ActivityPubManager.php +++ b/src/Service/ActivityPubManager.php @@ -1082,6 +1082,7 @@ public function extractRemoteLikeCount(array $apObject): ?int { if (!empty($apObject['likes'])) { if (false !== filter_var($apObject['likes'], FILTER_VALIDATE_URL)) { + $this->apHttpClient->invalidateCollectionObjectCache($apObject['likes']); $collection = $this->apHttpClient->getCollectionObject($apObject['likes']); if (isset($collection['totalItems']) && \is_int($collection['totalItems'])) { return $collection['totalItems']; @@ -1096,6 +1097,7 @@ public function extractRemoteDislikeCount(array $apObject): ?int { if (!empty($apObject['dislikes'])) { if (false !== filter_var($apObject['dislikes'], FILTER_VALIDATE_URL)) { + $this->apHttpClient->invalidateCollectionObjectCache($apObject['dislikes']); $collection = $this->apHttpClient->getCollectionObject($apObject['dislikes']); if (isset($collection['totalItems']) && \is_int($collection['totalItems'])) { return $collection['totalItems']; @@ -1110,6 +1112,7 @@ public function extractRemoteShareCount(array $apObject): ?int { if (!empty($apObject['shares'])) { if (false !== filter_var($apObject['shares'], FILTER_VALIDATE_URL)) { + $this->apHttpClient->invalidateCollectionObjectCache($apObject['shares']); $collection = $this->apHttpClient->getCollectionObject($apObject['shares']); if (isset($collection['totalItems']) && \is_int($collection['totalItems'])) { return $collection['totalItems'];