Skip to content

Commit

Permalink
Invalidate collection cache before getting collection for likes, disl…
Browse files Browse the repository at this point in the history
…ikes and shares (#1008)
  • Loading branch information
BentiGorlich authored Aug 8, 2024
1 parent 8949499 commit 0199619
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Service/ActivityPubManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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'];
Expand All @@ -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'];
Expand Down

0 comments on commit 0199619

Please sign in to comment.