branch: externals-release/ement
commit 22d4df7f5ae5ade5ccac0acc9a81a1a1cc053797
Author: Adam Porter <a...@alphapapa.net>
Commit: Adam Porter <a...@alphapapa.net>

    Fix: (ement-directory-define-column "Name") Unnamed rooms
    
    See 
<https://github.com/alphapapa/ement.el/issues/248#issuecomment-2152832345>.
---
 README.org         | 3 ++-
 ement-directory.el | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/README.org b/README.org
index ee44337a73..3f8d1ffbdf 100644
--- a/README.org
+++ b/README.org
@@ -299,7 +299,8 @@ Ement.el doesn't support encrypted rooms natively, but it 
can be used transparen
 
 ** 0.15.1-pre
 
-Nothing new yet.
+*Fixes*
++ Handle unnamed rooms in ~ement-directory~ list.  (See 
[[https://github.com/alphapapa/ement.el/issues/248][#248]].  Thanks to 
[[https://github.com/hjozwiak][Hunter Jozwiak]] and 
[[https://github.com/bmp][Bharath Palavalli]] for reporting.)
 
 ** 0.15
 :PROPERTIES:
diff --git a/ement-directory.el b/ement-directory.el
index 8a3fb1954b..73d307042a 100644
--- a/ement-directory.el
+++ b/ement-directory.el
@@ -129,7 +129,9 @@
       " ")))
 
 (ement-directory-define-column "Name" (:max-width 25)
-  (pcase-let* (((map name ('room_id id) ('room_type type)) item)
+  (pcase-let* (((map name ('room_id id) ('room_type type)
+                     ('canonical_alias canonical-alias))
+                item)
                ((map session) ement-directory-etc)
                (room)
                (face (pcase type
@@ -139,7 +141,9 @@
                                    (ement--room-direct-p room session))
                               'ement-room-list-direct
                             'ement-room-list-name)))))
-    (propertize (or name (ement--room-display-name room))
+    ;; NOTE: We can't use `ement--room-display-name' because these aren't room 
structs,
+    ;; and we don't have membership data.
+    (propertize (or name canonical-alias "[unnamed]")
                 'face face)))
 
 (ement-directory-define-column "Alias" (:max-width 25)

Reply via email to