Skip to content

Commit

Permalink
fix(Menu): Add fallback to service menu when service name is empty
Browse files Browse the repository at this point in the history
Closes #250
  • Loading branch information
adlk committed Nov 18, 2017
1 parent 8736c15 commit 42ed24d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/lib/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default class FranzMenu {

if (this.stores.user.isLoggedIn) {
return services.map((service, i) => ({
label: service.name,
label: this._getServiceName(service),
accelerator: i <= 9 ? `CmdOrCtrl+${i + 1}` : null,
type: 'radio',
checked: service.isActive,
Expand All @@ -289,4 +289,20 @@ export default class FranzMenu {

return [];
}

_getServiceName(service) {
if (service.name) {
return service.name;
}

let name = service.recipe.name;

if (service.team) {
name = `${name} (${service.team})`;
} else if (service.customUrl) {
name = `${name} (${service.customUrl})`;
}

return name;
}
}

0 comments on commit 42ed24d

Please sign in to comment.