disabling avatar notifications functionnal

This commit is contained in:
Nicolas Constant 2019-11-16 17:40:49 -05:00
parent d7d1952c5e
commit 6eb3e44923
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 11 additions and 6 deletions

View File

@ -79,23 +79,23 @@ export class LeftSideBarComponent implements OnInit, OnDestroy {
})); }));
} }
private selectPreviousAccount(){ private selectPreviousAccount() {
let accounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts; let accounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
let selectedAccount = accounts.find(x => x.isSelected); let selectedAccount = accounts.find(x => x.isSelected);
let selectedIndex = accounts.indexOf(selectedAccount); let selectedIndex = accounts.indexOf(selectedAccount);
if(selectedIndex > 0){ if (selectedIndex > 0) {
let previousAccount = accounts[selectedIndex - 1]; let previousAccount = accounts[selectedIndex - 1];
this.store.dispatch([new SelectAccount(previousAccount)]); this.store.dispatch([new SelectAccount(previousAccount)]);
} }
} }
private selectNextAccount(){ private selectNextAccount() {
let accounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts; let accounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
let selectedAccount = accounts.find(x => x.isSelected); let selectedAccount = accounts.find(x => x.isSelected);
let selectedIndex = accounts.indexOf(selectedAccount); let selectedIndex = accounts.indexOf(selectedAccount);
if(selectedIndex < accounts.length - 1){ if (selectedIndex < accounts.length - 1) {
let nextAccount = accounts[selectedIndex + 1]; let nextAccount = accounts[selectedIndex + 1];
this.store.dispatch([new SelectAccount(nextAccount)]); this.store.dispatch([new SelectAccount(nextAccount)]);
} }
@ -133,10 +133,15 @@ export class LeftSideBarComponent implements OnInit, OnDestroy {
}); });
this.notificationSub = this.userNotificationServiceService.userNotifications.subscribe((notifications: UserNotification[]) => { this.notificationSub = this.userNotificationServiceService.userNotifications.subscribe((notifications: UserNotification[]) => {
const settings = this.toolsService.getSettings();
notifications.forEach((notification: UserNotification) => { notifications.forEach((notification: UserNotification) => {
const acc = this.accounts.find(x => x.info.id === notification.account.id); const acc = this.accounts.find(x => x.info.id === notification.account.id);
if (acc) { if (acc) {
acc.hasActivityNotifications = notification.hasNewMentions || notification.hasNewNotifications; const accSettings = settings.accountSettings.find(x => x.accountId === acc.info.id);
if (!settings.disableAvatarNotifications && !accSettings.disableAvatarNotifications) {
acc.hasActivityNotifications = notification.hasNewMentions || notification.hasNewNotifications;
}
} }
}); });
}); });