fix favorites end condition retrieval
This commit is contained in:
parent
fbe5a53f60
commit
a82afc6bd1
|
@ -56,6 +56,11 @@ export class FavoritesComponent extends TimelineBase {
|
||||||
this.mastodonService.getFavorites(this.account)
|
this.mastodonService.getFavorites(this.account)
|
||||||
.then((result: FavoriteResult) => {
|
.then((result: FavoriteResult) => {
|
||||||
this.maxId = result.max_id;
|
this.maxId = result.max_id;
|
||||||
|
|
||||||
|
if (!this.maxId) {
|
||||||
|
this.lastCallReachedMax = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (const s of result.favorites) {
|
for (const s of result.favorites) {
|
||||||
let cwPolicy = this.toolsService.checkContentWarning(s);
|
let cwPolicy = this.toolsService.checkContentWarning(s);
|
||||||
const wrapper = new StatusWrapper(cwPolicy.status, this.account, cwPolicy.applyCw, cwPolicy.hide);
|
const wrapper = new StatusWrapper(cwPolicy.status, this.account, cwPolicy.applyCw, cwPolicy.hide);
|
||||||
|
@ -72,12 +77,14 @@ export class FavoritesComponent extends TimelineBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getNextStatuses(): Promise<Status[]> {
|
protected getNextStatuses(): Promise<Status[]> {
|
||||||
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) => {
|
.then((result: FavoriteResult) => {
|
||||||
const statuses = result.favorites;
|
const statuses = result.favorites;
|
||||||
this.maxId = result.max_id;
|
this.maxId = result.max_id;
|
||||||
|
|
||||||
if(!this.maxId){
|
if (!this.maxId) {
|
||||||
this.lastCallReachedMax = true;
|
this.lastCallReachedMax = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +92,7 @@ export class FavoritesComponent extends TimelineBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected scrolledToTop() {}
|
protected scrolledToTop() { }
|
||||||
|
|
||||||
protected statusProcessOnGoToTop(){}
|
protected statusProcessOnGoToTop() { }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue