mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
Display Unnamed User if no name found in user object (#1469)
* Display Unnamed User if no name found in user object * address review comment
This commit is contained in:
parent
10d44db8e6
commit
7e257f6ee9
@ -127,7 +127,7 @@ class HaSidebar extends
|
|||||||
<template is='dom-if' if='[[hass.user]]'>
|
<template is='dom-if' if='[[hass.user]]'>
|
||||||
<paper-icon-item on-click="menuClicked" data-panel="profile">
|
<paper-icon-item on-click="menuClicked" data-panel="profile">
|
||||||
<ha-icon slot="item-icon" icon="hass:account"></ha-icon>
|
<ha-icon slot="item-icon" icon="hass:account"></ha-icon>
|
||||||
<span class="item-text">[[hass.user.name]]</span>
|
<span class="item-text">[[_computeUserName(hass.user)]]</span>
|
||||||
</paper-icon-item>
|
</paper-icon-item>
|
||||||
</template>
|
</template>
|
||||||
</paper-listbox>
|
</paper-listbox>
|
||||||
@ -175,6 +175,10 @@ class HaSidebar extends
|
|||||||
return hass.config.core.components.indexOf('mqtt') !== -1;
|
return hass.config.core.components.indexOf('mqtt') !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_computeUserName(user) {
|
||||||
|
return user && (user.name || 'Unnamed User');
|
||||||
|
}
|
||||||
|
|
||||||
computePanelName(localize, panel) {
|
computePanelName(localize, panel) {
|
||||||
return localize(`panel.${panel.title}`) || panel.title;
|
return localize(`panel.${panel.title}`) || panel.title;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user