kopia lustrzana https://github.com/nextcloud/social
activityId is saved in db for streamable objects
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/374/head
rodzic
accf7e424d
commit
db55361148
|
@ -147,6 +147,17 @@ class CoreRequestBuilder {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the ActivityId
|
||||
*
|
||||
* @param IQueryBuilder $qb
|
||||
* @param string $activityId
|
||||
*/
|
||||
protected function limitToActivityId(IQueryBuilder &$qb, string $activityId) {
|
||||
$this->limitToDBField($qb, 'activity_id', $activityId, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Limit the request to the Preferred Username
|
||||
*
|
||||
|
|
|
@ -157,6 +157,32 @@ class NotesRequest extends NotesRequestBuilder {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return Note
|
||||
* @throws NoteNotFoundException
|
||||
*/
|
||||
public function getNoteByActivityId(string $id): Note {
|
||||
if ($id === '') {
|
||||
throw new NoteNotFoundException();
|
||||
};
|
||||
|
||||
$qb = $this->getNotesSelectSql();
|
||||
$this->limitToActivityId($qb, $id);
|
||||
|
||||
$cursor = $qb->execute();
|
||||
$data = $cursor->fetch();
|
||||
$cursor->closeCursor();
|
||||
|
||||
if ($data === false) {
|
||||
throw new NoteNotFoundException('Post not found');
|
||||
}
|
||||
|
||||
return $this->parseNotesSelectSql($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $actorId
|
||||
*
|
||||
|
|
|
@ -134,10 +134,9 @@ class NoteInterface implements IActivityPubInterface {
|
|||
if ($activity->getType() === Create::TYPE) {
|
||||
$activity->checkOrigin($item->getId());
|
||||
$activity->checkOrigin($item->getAttributedTo());
|
||||
$item->setActivityId($activity->getId());
|
||||
$this->save($item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue