From a82afc6bd16f9c62d6b7722f54217d7fcdea3929 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Fri, 28 Aug 2020 23:08:31 -0400 Subject: [PATCH] fix favorites end condition retrieval --- .../favorites/favorites.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/components/floating-column/manage-account/favorites/favorites.component.ts b/src/app/components/floating-column/manage-account/favorites/favorites.component.ts index e5f62441..5530ab06 100644 --- a/src/app/components/floating-column/manage-account/favorites/favorites.component.ts +++ b/src/app/components/floating-column/manage-account/favorites/favorites.component.ts @@ -56,6 +56,11 @@ export class FavoritesComponent extends TimelineBase { this.mastodonService.getFavorites(this.account) .then((result: FavoriteResult) => { this.maxId = result.max_id; + + if (!this.maxId) { + this.lastCallReachedMax = true; + } + for (const s of result.favorites) { let cwPolicy = this.toolsService.checkContentWarning(s); const wrapper = new StatusWrapper(cwPolicy.status, this.account, cwPolicy.applyCw, cwPolicy.hide); @@ -72,12 +77,14 @@ export class FavoritesComponent extends TimelineBase { } protected getNextStatuses(): Promise { - return this.mastodonService.getFavorites(this.account, this.maxId) + if (this.lastCallReachedMax) return Promise.resolve([]); + + return this.mastodonService.getFavorites(this.account, this.maxId) .then((result: FavoriteResult) => { const statuses = result.favorites; this.maxId = result.max_id; - if(!this.maxId){ + if (!this.maxId) { this.lastCallReachedMax = true; } @@ -85,7 +92,7 @@ export class FavoritesComponent extends TimelineBase { }); } - protected scrolledToTop() {} + protected scrolledToTop() { } - protected statusProcessOnGoToTop(){} + protected statusProcessOnGoToTop() { } }