summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-06-14 08:40:47 -0100
committerGitHub <noreply@github.com>2023-06-14 08:40:47 -0100
commit3cdaba38246a1a1f3b2401f2eaa8743742d93c57 (patch)
treed65c457576db9841d71b60e23ad6ac2521fc6197
parent086d3c3924357dfc8e96b1501f8150b7da86744c (diff)
parent2150774b9dad6c2e3db716a025358b7328004f7c (diff)
Merge pull request #1781 from nextcloud/fix/noid/update-stream-details
update stream details
-rw-r--r--lib/Db/StreamRequest.php10
-rw-r--r--lib/Interfaces/Object/AnnounceInterface.php2
-rw-r--r--lib/Interfaces/Object/LikeInterface.php6
-rw-r--r--lib/Interfaces/Object/NoteInterface.php2
4 files changed, 12 insertions, 8 deletions
diff --git a/lib/Db/StreamRequest.php b/lib/Db/StreamRequest.php
index a5f38dcf..ac673985 100644
--- a/lib/Db/StreamRequest.php
+++ b/lib/Db/StreamRequest.php
@@ -105,7 +105,6 @@ class StreamRequest extends StreamRequestBuilder {
public function update(Stream $stream, bool $generateDest = false): void {
$qb = $this->getStreamUpdateSql();
- $qb->set('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())));
$qb->set('to', $qb->createNamedParameter($stream->getTo()));
$qb->set(
'cc', $qb->createNamedParameter(json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES))
@@ -121,6 +120,15 @@ class StreamRequest extends StreamRequestBuilder {
}
}
+
+ public function updateDetails(Stream $stream): void {
+ $qb = $this->getStreamUpdateSql();
+ $qb->set('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())));
+ $qb->limitToIdPrim($qb->prim($stream->getId()));
+ $qb->executeStatement();
+ }
+
+
public function updateCache(Stream $stream, Cache $cache): void {
$qb = $this->getStreamUpdateSql();
$qb->set('cache', $qb->createNamedParameter(json_encode($cache, JSON_UNESCAPED_SLASHES)));
diff --git a/lib/Interfaces/Object/AnnounceInterface.php b/lib/Interfaces/Object/AnnounceInterface.php
index f3456206..1f18fe52 100644
--- a/lib/Interfaces/Object/AnnounceInterface.php
+++ b/lib/Interfaces/Object/AnnounceInterface.php
@@ -305,7 +305,7 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
'boosts', $this->actionsRequest->countActions($post->getId(), Announce::TYPE)
);
- $this->streamRequest->update($post, true);
+ $this->streamRequest->updateDetails($post);
}
/**
diff --git a/lib/Interfaces/Object/LikeInterface.php b/lib/Interfaces/Object/LikeInterface.php
index 4066cb67..432688fb 100644
--- a/lib/Interfaces/Object/LikeInterface.php
+++ b/lib/Interfaces/Object/LikeInterface.php
@@ -172,15 +172,11 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub
}
private function updateDetails(Stream $post): void {
- // if (!$post->isLocal()) {
- // return;
- // }
-
$post->setDetailInt(
'likes', $this->actionsRequest->countActions($post->getId(), Like::TYPE)
);
- $this->streamRequest->update($post, true);
+ $this->streamRequest->updateDetails($post);
}
diff --git a/lib/Interfaces/Object/NoteInterface.php b/lib/Interfaces/Object/NoteInterface.php
index 161a79b6..27fccfe9 100644
--- a/lib/Interfaces/Object/NoteInterface.php
+++ b/lib/Interfaces/Object/NoteInterface.php
@@ -127,7 +127,7 @@ class NoteInterface extends AbstractActivityPubInterface implements IActivityPub
$count = $this->streamRequest->countRepliesTo($stream->getInReplyTo());
$orig->setDetailInt('replies', $count);
- $this->streamRequest->update($orig);
+ $this->streamRequest->updateDetails($orig);
} catch (StreamNotFoundException $e) {
}
}