diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index f4be158d..bd0512dd 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -124,10 +124,11 @@ class ActivityPubController extends Controller { * @param string $username * * @return Response + * @throws \OC\User\NoUserException */ public function actor(string $username): Response { if (!$this->checkSourceActivityStreams()) { - return $this->navigationController->public(); + return $this->navigationController->public($username); } try { diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index ece994b8..c824aeaa 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -181,11 +181,11 @@ class LocalController extends Controller { * * @return DataResponse */ - public function streamHome(): DataResponse { + public function streamHome(int $since = 0, int $limit = 5): DataResponse { try { $actor = $this->actorService->getActorFromUserId($this->userId); - $posts = $this->noteService->getHomeNotesForActor($actor); + $posts = $this->noteService->getHomeNotesForActor($actor, $since, $limit); return $this->success($posts); } catch (Exception $e) { @@ -203,11 +203,11 @@ class LocalController extends Controller { * * @return DataResponse */ - public function streamDirect(): DataResponse { + public function streamDirect(int $since = 0, int $limit = 5): DataResponse { try { $actor = $this->actorService->getActorFromUserId($this->userId); - $posts = $this->noteService->getDirectNotesForActor($actor); + $posts = $this->noteService->getDirectNotesForActor($actor, $since, $limit); return $this->success($posts); } catch (Exception $e) { diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php index c8795d6a..715a722a 100644 --- a/lib/Db/NotesRequest.php +++ b/lib/Db/NotesRequest.php @@ -142,11 +142,12 @@ class NotesRequest extends NotesRequestBuilder { * * @return array */ - public function getHomeNotesForActorId(string $actorId): array { + public function getHomeNotesForActorId(string $actorId, $since, $limit): array { $qb = $this->getNotesSelectSql(); $this->rightJoinFollowing($qb); $this->limitToActorId($qb, $actorId, 'f'); + $this->limitPaginate($qb, $since, $limit); // $this->leftJoinCacheActors($qb, 'attributed_to'); $notes = []; @@ -192,9 +193,10 @@ class NotesRequest extends NotesRequestBuilder { * * @return array */ - public function getDirectNotesForActorId(string $actorId): array { + public function getDirectNotesForActorId(string $actorId, $since, $limit): array { $qb = $this->getNotesSelectSql(); $this->limitToRecipient($qb, $actorId); + $this->limitPaginate($qb, $since, $limit); $this->leftJoinCacheActors($qb, 'attributed_to'); $notes = []; diff --git a/lib/Service/ActivityPub/NoteService.php b/lib/Service/ActivityPub/NoteService.php index cc005ce0..2adecf1c 100644 --- a/lib/Service/ActivityPub/NoteService.php +++ b/lib/Service/ActivityPub/NoteService.php @@ -312,8 +312,8 @@ class NoteService implements ICoreService { * * @return Note[] */ - public function getHomeNotesForActor(Person $actor): array { - return $this->notesRequest->getHomeNotesForActorId($actor->getId()); + public function getHomeNotesForActor(Person $actor, $since, $limit): array { + return $this->notesRequest->getHomeNotesForActorId($actor->getId(), $since, $limit); } @@ -322,8 +322,8 @@ class NoteService implements ICoreService { * * @return Note[] */ - public function getDirectNotesForActor(Person $actor): array { - return $this->notesRequest->getDirectNotesForActorId($actor->getId()); + public function getDirectNotesForActor(Person $actor, $since, $limit): array { + return $this->notesRequest->getDirectNotesForActorId($actor->getId(), $since, $limit); } diff --git a/src/App.vue b/src/App.vue index e28879c0..ef25ee57 100644 --- a/src/App.vue +++ b/src/App.vue @@ -120,23 +120,23 @@ export default { classes: [] }, { - id: 'social-timeline', + id: 'social-local', classes: [], icon: 'icon-category-monitoring', text: t('social', 'Local timeline'), router: { name: 'timeline', - params: { type: 'local' } + params: { type: 'timeline' } } }, { - id: 'social-timeline', + id: 'social-global', classes: [], icon: 'icon-link', text: t('social', 'Global timeline'), router: { name: 'timeline', - params: { type: 'global' } + params: { type: 'federated' } } } ]