From 61e543adc95b26bc81024c1d45376ef49bd4f2a7 Mon Sep 17 00:00:00 2001 From: addison Date: Wed, 10 Nov 2021 18:58:18 -0500 Subject: [PATCH] [style] Fix lint complaints --- src/app/app.component.ts | 2 +- src/main/menu.main.ts | 60 +++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0b8440d9..75fe648f 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -349,7 +349,7 @@ export class AppComponent implements OnInit { accounts: null, activeUserId: null, enableChangeMasterPass: false, - } + }; } else { const accounts: { [userId: string]: any } = {}; for (const i in stateAccounts) { diff --git a/src/main/menu.main.ts b/src/main/menu.main.ts index 4dbe813f..7759739e 100644 --- a/src/main/menu.main.ts +++ b/src/main/menu.main.ts @@ -105,35 +105,37 @@ export class MenuMain extends BaseMenu { this.lockNow.enabled = true; this.logOut.enabled = true; - for (const i in accounts) { - if (this.lockNow.submenu.getMenuItemById(`lockNow_${accounts[i].userId}`) == null) { - const options: MenuItemConstructorOptions = { - label: accounts[i].email, - id: `lockNow_${accounts[i].userId}`, - click: () => this.main.messagingService.send('lockVault', { userId: accounts[i].userId }), - }; - this.lockNow.submenu.insert(0, new MenuItem(options)); - } - if (this.logOut.submenu.getMenuItemById(`logOut_${accounts[i].userId}`) == null) { - const options: MenuItemConstructorOptions = { - label: accounts[i].email, - id: `logOut_${accounts[i].userId}`, - click: async () => { - const result = await dialog.showMessageBox(this.windowMain.win, { - title: this.i18nService.t('logOut'), - message: this.i18nService.t('logOut'), - detail: this.i18nService.t('logOutConfirmation'), - buttons: [this.i18nService.t('logOut'), this.i18nService.t('cancel')], - cancelId: 1, - defaultId: 0, - noLink: true, - }); - if (result.response === 0) { - this.main.messagingService.send('logout', { userId: accounts[i].userId }); - } - }, - }; - this.logOut.submenu.insert(0, new MenuItem(options)); + for (const userId in accounts) { + if (userId != null) { + if (this.lockNow.submenu.getMenuItemById(`lockNow_${accounts[userId].userId}`) == null) { + const options: MenuItemConstructorOptions = { + label: accounts[userId].email, + id: `lockNow_${accounts[userId].userId}`, + click: () => this.main.messagingService.send('lockVault', { userId: accounts[userId].userId }), + }; + this.lockNow.submenu.insert(0, new MenuItem(options)); + } + if (this.logOut.submenu.getMenuItemById(`logOut_${accounts[userId].userId}`) == null) { + const options: MenuItemConstructorOptions = { + label: accounts[userId].email, + id: `logOut_${accounts[userId].userId}`, + click: async () => { + const result = await dialog.showMessageBox(this.windowMain.win, { + title: this.i18nService.t('logOut'), + message: this.i18nService.t('logOut'), + detail: this.i18nService.t('logOutConfirmation'), + buttons: [this.i18nService.t('logOut'), this.i18nService.t('cancel')], + cancelId: 1, + defaultId: 0, + noLink: true, + }); + if (result.response === 0) { + this.main.messagingService.send('logout', { userId: accounts[userId].userId }); + } + }, + }; + this.logOut.submenu.insert(0, new MenuItem(options)); + } } } }