get public messages from an account

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/134/head
Maxence Lange 2018-12-04 23:01:07 -01:00 zatwierdzone przez Julius Härtl
rodzic 6af499a817
commit 61a28c2171
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4C614C6ED2CDE6DF
3 zmienionych plików z 32 dodań i 3 usunięć

Wyświetl plik

@ -68,6 +68,7 @@ return [
['name' => 'Local#streamTimeline', 'url' => '/api/v1/stream/timeline', 'verb' => 'GET'],
['name' => 'Local#streamFederated', 'url' => '/api/v1/stream/federated', 'verb' => 'GET'],
['name' => 'Local#streamDirect', 'url' => '/api/v1/stream/direct', 'verb' => 'GET'],
['name' => 'Local#streamAccount', 'url' => '/api/v1/account/{username}/stream', 'verb' => 'GET'],
['name' => 'Local#postCreate', 'url' => '/api/v1/post', 'verb' => 'POST'],
['name' => 'Local#postDelete', 'url' => '/api/v1/post', 'verb' => 'DELETE'],

Wyświetl plik

@ -189,10 +189,38 @@ class NotesRequest extends NotesRequestBuilder {
/**
* Should returns:
* Should returns:
* * public message from actorId.
* - to followers-only if follower is logged.
*
* @param string $actorId
* @param int $since
* @param int $limit
*
* @return array
*/
public function getStreamAccount(string $actorId, int $since = 0, int $limit = 5): array {
$qb = $this->getNotesSelectSql();
$this->limitToRecipient($qb, ActivityService::TO_PUBLIC);
$this->limitPaginate($qb, $since, $limit);
$this->limitToAttributedTo($qb, $actorId);
$notes = [];
$cursor = $qb->execute();
while ($data = $cursor->fetch()) {
$notes[] = $this->parseNotesSelectSql($data);
}
$cursor->closeCursor();
return $notes;
}
/**
* Should returns:
* * Private message.
* - group messages.
*
* @param string $actorId
* @param int $since
* @param int $limit

Wyświetl plik

@ -370,7 +370,7 @@ class NoteService implements ICoreService {
* @return Note[]
*/
public function getStreamAccount(string $actorId, int $since = 0, int $limit = 5): array {
return $this->notesRequest->getStreamHome($actorId, $since, $limit);
return $this->notesRequest->getStreamAccount($actorId, $since, $limit);
}