diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-12-04 23:01:07 -0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-12-05 09:53:24 +0100 |
commit | 61a28c21711332edca0642ca153f6854ed33591c (patch) | |
tree | 9f4b9590ab7190d67a16a59ac0eb7ecdb1fa4ed4 /lib/Db | |
parent | 6af499a81781a65e6e6f5a20f3e616b8ada480d1 (diff) |
get public messages from an account
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Db')
-rw-r--r-- | lib/Db/NotesRequest.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php index cc3fd342..ec9aca9f 100644 --- a/lib/Db/NotesRequest.php +++ b/lib/Db/NotesRequest.php @@ -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 |