kopia lustrzana https://github.com/nextcloud/social
generate token and cache content
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/462/head
rodzic
0f714cfda1
commit
47b2268021
|
|
@ -30,7 +30,9 @@ declare(strict_types=1);
|
|||
namespace OCA\Social\Service;
|
||||
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\AP;
|
||||
use OCA\Social\Db\NotesRequest;
|
||||
use OCA\Social\Exceptions\NoteNotFoundException;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
|
|
@ -49,6 +51,9 @@ use OCA\Social\Model\ActivityPub\Stream;
|
|||
class BoostService {
|
||||
|
||||
|
||||
use TStringTools;
|
||||
|
||||
|
||||
/** @var NotesRequest */
|
||||
private $notesRequest;
|
||||
|
||||
|
|
@ -125,19 +130,17 @@ class BoostService {
|
|||
|
||||
$announce->addCc($note->getAttributedTo());
|
||||
$announce->setObjectId($note->getId());
|
||||
if ($note->isLocal()) {
|
||||
$announce->setObject($note);
|
||||
} else {
|
||||
$announce->addCacheItem($note->getId());
|
||||
}
|
||||
$announce->setRequestToken($this->uuid());
|
||||
|
||||
$this->notesRequest->save($announce);
|
||||
$interface = AP::$activityPub->getInterfaceFromType(Announce::TYPE);
|
||||
$interface->save($announce);
|
||||
|
||||
$this->streamActionService->setActionBool($actor->getId(), $postId, 'boosted', true);
|
||||
$this->signatureService->signObject($actor, $announce);
|
||||
|
||||
$token = $this->activityService->request($announce);
|
||||
|
||||
$this->streamQueueService->cacheStreamByToken($token);
|
||||
$this->streamQueueService->cacheStreamByToken($announce->getRequestToken());
|
||||
|
||||
return $announce;
|
||||
}
|
||||
|
|
@ -184,6 +187,7 @@ class BoostService {
|
|||
$this->notesRequest->deleteNoteById($announce->getId());
|
||||
$this->streamActionService->setActionBool($actor->getId(), $postId, 'boosted', false);
|
||||
$this->signatureService->signObject($actor, $undo);
|
||||
|
||||
$token = $this->activityService->request($undo);
|
||||
|
||||
return $undo;
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue