prevent spamming, fix #293
This commit is contained in:
parent
c30ba1483a
commit
82a4452a41
|
@ -66,8 +66,9 @@ export abstract class TimelineBase extends BrowseBase {
|
|||
}
|
||||
}
|
||||
|
||||
private scrolledErrorOccured = false;
|
||||
protected scrolledToBottom() {
|
||||
if (this.isLoading || this.maxReached) return;
|
||||
if (this.isLoading || this.maxReached || this.scrolledErrorOccured) return;
|
||||
|
||||
this.isLoading = true;
|
||||
this.isProcessingInfiniteScroll = true;
|
||||
|
@ -86,6 +87,11 @@ export abstract class TimelineBase extends BrowseBase {
|
|||
}
|
||||
})
|
||||
.catch((err: HttpErrorResponse) => {
|
||||
this.scrolledErrorOccured = true;
|
||||
setTimeout(() => {
|
||||
this.scrolledErrorOccured = false;
|
||||
}, 5000);
|
||||
|
||||
this.notificationService.notifyHttpError(err, this.account);
|
||||
})
|
||||
.then(() => {
|
||||
|
|
|
@ -87,8 +87,9 @@ export class DirectMessagesComponent extends BrowseBase {
|
|||
}
|
||||
}
|
||||
|
||||
private scrolledErrorOccured = false;
|
||||
private scrolledToBottom() {
|
||||
if (this.isLoading || this.maxReached) return;
|
||||
if (this.isLoading || this.maxReached || this.scrolledErrorOccured) return;
|
||||
|
||||
const maxId = this.conversations[this.conversations.length - 1].conversation.last_status.id;
|
||||
|
||||
|
@ -108,6 +109,11 @@ export class DirectMessagesComponent extends BrowseBase {
|
|||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.scrolledErrorOccured = true;
|
||||
setTimeout(() => {
|
||||
this.scrolledErrorOccured = false;
|
||||
}, 5000);
|
||||
|
||||
this.notificationService.notifyHttpError(err, this.account.info);
|
||||
})
|
||||
.then(() => {
|
||||
|
|
|
@ -94,8 +94,9 @@ export class NotificationsComponent extends BrowseBase {
|
|||
}
|
||||
}
|
||||
|
||||
private scrolledErrorOccured = false;
|
||||
private scrolledToBottom() {
|
||||
if (this.isLoading || this.maxReached || this.notifications.length === 0) return;
|
||||
if (this.isLoading || this.maxReached || this.notifications.length === 0 || this.scrolledErrorOccured) return;
|
||||
|
||||
this.isLoading = true;
|
||||
this.isProcessingInfiniteScroll = true;
|
||||
|
@ -118,6 +119,11 @@ export class NotificationsComponent extends BrowseBase {
|
|||
this.lastId = notifications[notifications.length - 1].id;
|
||||
})
|
||||
.catch(err => {
|
||||
this.scrolledErrorOccured = true;
|
||||
setTimeout(() => {
|
||||
this.scrolledErrorOccured = false;
|
||||
}, 5000);
|
||||
|
||||
this.notificationService.notifyHttpError(err, this.account.info);
|
||||
})
|
||||
.then(() => {
|
||||
|
|
|
@ -194,8 +194,9 @@ export class StreamNotificationsComponent extends BrowseBase {
|
|||
}
|
||||
}
|
||||
|
||||
private scrolledErrorOccured = false;
|
||||
notificationsScrolledToBottom(): any {
|
||||
if (this.isNotificationsLoading || this.notificationsMaxReached || this.notifications.length === 0)
|
||||
if (this.isNotificationsLoading || this.notificationsMaxReached || this.notifications.length === 0 || this.scrolledErrorOccured)
|
||||
return;
|
||||
|
||||
this.isNotificationsLoading = true;
|
||||
|
@ -216,6 +217,11 @@ export class StreamNotificationsComponent extends BrowseBase {
|
|||
this.lastNotificationId = result[result.length - 1].id;
|
||||
})
|
||||
.catch(err => {
|
||||
this.scrolledErrorOccured = true;
|
||||
setTimeout(() => {
|
||||
this.scrolledErrorOccured = false;
|
||||
}, 5000);
|
||||
|
||||
this.notificationService.notifyHttpError(err, this.account);
|
||||
})
|
||||
.then(() => {
|
||||
|
@ -224,7 +230,7 @@ export class StreamNotificationsComponent extends BrowseBase {
|
|||
}
|
||||
|
||||
mentionsScrolledToBottom(): any {
|
||||
if (this.isMentionsLoading || this.mentionsMaxReached || this.mentions.length === 0)
|
||||
if (this.isMentionsLoading || this.mentionsMaxReached || this.mentions.length === 0 || this.scrolledErrorOccured)
|
||||
return;
|
||||
|
||||
this.isMentionsLoading = true;
|
||||
|
@ -245,6 +251,11 @@ export class StreamNotificationsComponent extends BrowseBase {
|
|||
this.lastMentionId = result[result.length - 1].id;
|
||||
})
|
||||
.catch(err => {
|
||||
this.scrolledErrorOccured = true;
|
||||
setTimeout(() => {
|
||||
this.scrolledErrorOccured = false;
|
||||
}, 5000);
|
||||
|
||||
this.notificationService.notifyHttpError(err, this.account);
|
||||
})
|
||||
.then(() => {
|
||||
|
|
Loading…
Reference in New Issue