changeset 374:3002704318e3

core (common_widgets): fixed own jid detection in DeviceWidget + `name` property in Identities
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:09 +0100
parents 5d994be1161b
children ae9059b791fe
files cagou/core/common_widgets.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/common_widgets.py	Mon Jan 27 21:17:09 2020 +0100
+++ b/cagou/core/common_widgets.py	Mon Jan 27 21:17:09 2020 +0100
@@ -77,7 +77,9 @@
 
     @property
     def name(self):
-        return list(self.identities.values())[0].values()[0][0]
+        first_identity = next(iter(self.identities.values()))
+        names = next(iter(first_identity.values()))
+        return names[0]
 
 
 class ItemWidget(TouchMenuItemBehaviour, BoxLayout):
@@ -91,7 +93,7 @@
         self.entity_jid = entity_jid
         self.identities = identities
         own_jid = next(iter(G.host.profiles.values())).whoami
-        self.own_device = entity_jid.bare == own_jid
+        self.own_device = entity_jid.bare == own_jid.bare
         if self.own_device:
             name = self.identities.name
         elif self.entity_jid.node: