object returned in the stream

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/374/head
Maxence Lange 2019-01-26 10:57:07 -01:00
rodzic 4b3e206ec1
commit 823773fbbe
4 zmienionych plików z 20 dodań i 17 usunięć

Wyświetl plik

@ -101,6 +101,7 @@ class NotesRequest extends NotesRequestBuilder {
->setValue('attributed_to', $qb->createNamedParameter($note->getAttributedTo()))
->setValue('in_reply_to', $qb->createNamedParameter($note->getInReplyTo()))
->setValue('source', $qb->createNamedParameter($note->getSource()))
->setValue('object_id', $qb->createNamedParameter($note->getObjectId()))
->setValue('cache', $qb->createNamedParameter($cache))
->setValue(
'instances', $qb->createNamedParameter(

Wyświetl plik

@ -82,8 +82,9 @@ class NotesRequestBuilder extends CoreRequestBuilder {
/** @noinspection PhpMethodParametersCountMismatchInspection */
$qb->select(
'sn.id', 'sn.type', 'sn.to', 'sn.to_array', 'sn.cc', 'sn.bcc', 'sn.content',
'sn.summary', 'sn.published', 'sn.published_time', 'sn.cache', 'sn.attributed_to',
'sn.in_reply_to', 'sn.source', 'sn.local', 'sn.instances', 'sn.creation'
'sn.summary', 'sn.published', 'sn.published_time', 'sn.cache', 'sn.object_id',
'sn.attributed_to', 'sn.in_reply_to', 'sn.source', 'sn.local', 'sn.instances',
'sn.creation'
)
->from(self::TABLE_SERVER_NOTES, 'sn');

Wyświetl plik

@ -98,17 +98,7 @@ class AnnounceInterface implements IActivityPubInterface {
/** @var Stream $item */
$item->checkOrigin($item->getId());
try {
$this->notesRequest->getNoteById($item->getId());
} catch (NoteNotFoundException $e) {
$objectId = $item->getObjectId();
$item->addCacheItem($objectId);
$this->notesRequest->save($item);
$this->streamQueueService->generateStreamQueue(
$item->getRequestToken(), StreamQueue::TYPE_CACHE, $item->getId()
);
}
$this->save($item);
}
@ -134,7 +124,17 @@ class AnnounceInterface implements IActivityPubInterface {
*/
public function save(ACore $item) {
/** @var Announce $item */
// $this->cacheDocumentsRequest->save($item);
try {
$this->notesRequest->getNoteById($item->getId());
} catch (NoteNotFoundException $e) {
$objectId = $item->getObjectId();
$item->addCacheItem($objectId);
$this->notesRequest->save($item);
$this->streamQueueService->generateStreamQueue(
$item->getRequestToken(), StreamQueue::TYPE_CACHE, $item->getId()
);
}
}
@ -142,7 +142,6 @@ class AnnounceInterface implements IActivityPubInterface {
* @param ACore $item
*/
public function delete(ACore $item) {
// $this->cacheDocumentsRequest->delete($item);
}

Wyświetl plik

@ -261,6 +261,7 @@ class Stream extends ACore implements JsonSerializable {
$this->setInReplyTo($this->validate(self::AS_ID, 'inReplyTo', $data, ''));
$this->setAttributedTo($this->validate(self::AS_ID, 'attributedTo', $data, ''));
$this->setSensitive($this->getBool('sensitive', $data, false));
$this->setObjectId($this->get('object', $data, ''));
$this->setConversation($this->validate(self::AS_ID, 'conversation', $data, ''));
$this->setContent($this->get('content', $data, ''));
$this->convertPublished();
@ -276,8 +277,9 @@ class Stream extends ACore implements JsonSerializable {
$dTime = new DateTime($this->get('published_time', $data, 'yesterday'));
$this->setActivityId($this->validate(self::AS_ID, 'activity_id', $data, ''));
$this->setContent($this->validate(self::AS_STRING, 'content', $data, ''));;
$this->setContent($this->validate(self::AS_STRING, 'content', $data, ''));
$this->setPublishedTime($dTime->getTimestamp());
$this->setObjectId($this->validate(self::AS_ID, 'object_id', $data, ''));
$this->setAttributedTo($this->validate(self::AS_ID, 'attributed_to', $data, ''));
$this->setInReplyTo($this->validate(self::AS_ID, 'in_reply_to', $data));
@ -305,7 +307,7 @@ class Stream extends ACore implements JsonSerializable {
);
if ($this->isCompleteDetails()) {
array_merge(
$result = array_merge(
$result,
[
'cache' => $this->getCache()