Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
Fix: Don't return empty strings for room displaynames
Browse files Browse the repository at this point in the history
  • Loading branch information
alphapapa committed Oct 16, 2018
1 parent 55c5593 commit 81bb5c5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions matrix-client-room.el
Original file line number Diff line number Diff line change
Expand Up @@ -471,15 +471,21 @@ a different name is returned."
;; This macro allows short-circuiting the choice forms, only evaluating them when needed.
`(or ,@(cl-loop for choice in choices
collect `(--when-let ,choice
;; NOTE: We check to see if strings are empty,
;; because apparently it can happen that an
;; mxid is something like "@:hostname", with
;; an empty displayname. Sigh.
(if (listp it)
(cl-loop for this-choice in (-non-nil (-flatten it))
unless (--when-let (get-buffer this-choice)
;; Allow reusing current name of current buffer
(not (equal it (oref* room extra buffer))))
unless (or (string-empty-p this-choice)
(--when-let (get-buffer this-choice)
;; Allow reusing current name of current buffer
(not (equal it (oref* room extra buffer)))))
return this-choice)
(unless (--when-let (get-buffer it)
;; Allow reusing current name of current buffer
(not (equal it (oref* room extra buffer))))
(unless (or (string-empty-p it)
(--when-let (get-buffer it)
;; Allow reusing current name of current buffer
(not (equal it (oref* room extra buffer)))))
it)))))))
(pcase-let* (((eieio id name aliases members session) room)
((eieio (user self)) session))
Expand Down

0 comments on commit 81bb5c5

Please sign in to comment.