kopia lustrzana https://github.com/nextcloud/social
Merge pull request #1781 from nextcloud/fix/noid/update-stream-details
update stream detailspull/1783/head
commit
3cdaba3824
|
@ -105,7 +105,6 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
public function update(Stream $stream, bool $generateDest = false): void {
|
public function update(Stream $stream, bool $generateDest = false): void {
|
||||||
$qb = $this->getStreamUpdateSql();
|
$qb = $this->getStreamUpdateSql();
|
||||||
|
|
||||||
$qb->set('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())));
|
|
||||||
$qb->set('to', $qb->createNamedParameter($stream->getTo()));
|
$qb->set('to', $qb->createNamedParameter($stream->getTo()));
|
||||||
$qb->set(
|
$qb->set(
|
||||||
'cc', $qb->createNamedParameter(json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES))
|
'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 {
|
public function updateCache(Stream $stream, Cache $cache): void {
|
||||||
$qb = $this->getStreamUpdateSql();
|
$qb = $this->getStreamUpdateSql();
|
||||||
$qb->set('cache', $qb->createNamedParameter(json_encode($cache, JSON_UNESCAPED_SLASHES)));
|
$qb->set('cache', $qb->createNamedParameter(json_encode($cache, JSON_UNESCAPED_SLASHES)));
|
||||||
|
|
|
@ -305,7 +305,7 @@ class AnnounceInterface extends AbstractActivityPubInterface implements IActivit
|
||||||
'boosts', $this->actionsRequest->countActions($post->getId(), Announce::TYPE)
|
'boosts', $this->actionsRequest->countActions($post->getId(), Announce::TYPE)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->streamRequest->update($post, true);
|
$this->streamRequest->updateDetails($post);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -172,15 +172,11 @@ class LikeInterface extends AbstractActivityPubInterface implements IActivityPub
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateDetails(Stream $post): void {
|
private function updateDetails(Stream $post): void {
|
||||||
// if (!$post->isLocal()) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$post->setDetailInt(
|
$post->setDetailInt(
|
||||||
'likes', $this->actionsRequest->countActions($post->getId(), Like::TYPE)
|
'likes', $this->actionsRequest->countActions($post->getId(), Like::TYPE)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->streamRequest->update($post, true);
|
$this->streamRequest->updateDetails($post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ class NoteInterface extends AbstractActivityPubInterface implements IActivityPub
|
||||||
$count = $this->streamRequest->countRepliesTo($stream->getInReplyTo());
|
$count = $this->streamRequest->countRepliesTo($stream->getInReplyTo());
|
||||||
$orig->setDetailInt('replies', $count);
|
$orig->setDetailInt('replies', $count);
|
||||||
|
|
||||||
$this->streamRequest->update($orig);
|
$this->streamRequest->updateDetails($orig);
|
||||||
} catch (StreamNotFoundException $e) {
|
} catch (StreamNotFoundException $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue