aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Menu.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js
index fb92644d0..7a60c448f 100644
--- a/src/lib/Menu.js
+++ b/src/lib/Menu.js
@@ -1,5 +1,5 @@
1import { remote, shell } from 'electron'; 1import { remote, shell } from 'electron';
2import { observable, autorun, computed } from 'mobx'; 2import { observable, autorun } from 'mobx';
3import { defineMessages } from 'react-intl'; 3import { defineMessages } from 'react-intl';
4 4
5import { isMac, ctrlKey, cmdKey } from '../environment'; 5import { isMac, ctrlKey, cmdKey } from '../environment';
@@ -535,7 +535,8 @@ export default class FranzMenu {
535 } 535 }
536 536
537 _build() { 537 _build() {
538 const serviceTpl = Object.assign([], this.serviceTpl); // need to clone object so we don't modify computed (cached) object 538 // need to clone object so we don't modify computed (cached) object
539 const serviceTpl = Object.assign([], this.serviceTpl());
539 540
540 if (window.franz === undefined) { 541 if (window.franz === undefined) {
541 return; 542 return;
@@ -708,7 +709,7 @@ export default class FranzMenu {
708 Menu.setApplicationMenu(menu); 709 Menu.setApplicationMenu(menu);
709 } 710 }
710 711
711 @computed get serviceTpl() { 712 serviceTpl() {
712 const { intl } = window.franz; 713 const { intl } = window.franz;
713 const { user, services, settings } = this.stores; 714 const { user, services, settings } = this.stores;
714 if (!user.isLoggedIn) return []; 715 if (!user.isLoggedIn) return [];
@@ -740,17 +741,15 @@ export default class FranzMenu {
740 type: 'separator', 741 type: 'separator',
741 }); 742 });
742 743
743 if (this.stores.user.isLoggedIn) { 744 services.allDisplayed.forEach((service, i) => (menu.push({
744 services.allDisplayed.forEach((service, i) => (menu.push({ 745 label: this._getServiceName(service),
745 label: this._getServiceName(service), 746 accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null,
746 accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, 747 type: 'radio',
747 type: 'radio', 748 checked: service.isActive,
748 checked: service.isActive, 749 click: () => {
749 click: () => { 750 this.actions.service.setActive({ serviceId: service.id });
750 this.actions.service.setActive({ serviceId: service.id }); 751 },
751 }, 752 })));
752 })));
753 }
754 753
755 return menu; 754 return menu;
756 } 755 }