kopia lustrzana https://github.com/nextcloud/social
Load streams with pagination
Signed-off-by: Julius Härtl <jus@bitgrid.net>pull/52/head
rodzic
9375d246b9
commit
69201a9ce2
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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' }
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Ładowanie…
Reference in New Issue