set dedicated since_id for notifications

This commit is contained in:
Nicolas Constant 2020-04-19 03:18:37 -04:00
parent b1a8ffee2f
commit e2d1e1893a
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 4 additions and 3 deletions

View File

@ -30,6 +30,7 @@ export class StreamingWrapper {
private apiRoutes = new ApiRoutes(); private apiRoutes = new ApiRoutes();
private errorClosing: boolean; private errorClosing: boolean;
private since_id: string; private since_id: string;
private since_id_notifications: string;
private disposed: boolean; private disposed: boolean;
constructor( constructor(
@ -88,10 +89,10 @@ export class StreamingWrapper {
} }
private pullNewNotifications() { private pullNewNotifications() {
this.mastodonService.getNotifications(this.account, null, null, this.since_id, 10) this.mastodonService.getNotifications(this.account, null, null, this.since_id_notifications, 10)
.then((notifications: Notification[]) => { .then((notifications: Notification[]) => {
//notifications = notifications.sort((a, b) => a.id.localeCompare(b.id)); //notifications = notifications.sort((a, b) => a.id.localeCompare(b.id));
let soundMuted = !this.since_id; let soundMuted = !this.since_id_notifications;
notifications = notifications.reverse(); notifications = notifications.reverse();
for (const n of notifications) { for (const n of notifications) {
@ -101,7 +102,7 @@ export class StreamingWrapper {
update.type = EventEnum.notification; update.type = EventEnum.notification;
update.muteSound = soundMuted; update.muteSound = soundMuted;
this.since_id = n.id; this.since_id_notifications = n.id;
this.statusUpdateSubjet.next(update); this.statusUpdateSubjet.next(update);
} }
}) })