summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-06-14 00:32:33 -0100
committerMaxence Lange <maxence@artificial-owl.com>2023-06-14 00:32:33 -0100
commit2150774b9dad6c2e3db716a025358b7328004f7c (patch)
tree3c08829fbe96968a44237aa682c6ba8f972da10c
parent0f2c5816e00f1c774191472487df7b006c417f29 (diff)
update stream details
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-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 bd29ba6b..7b6b0e9f 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) {
}
}