[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ement e046f66ba2 1/2: Fix: (ement-room-list--entry) Whe
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ement e046f66ba2 1/2: Fix: (ement-room-list--entry) When room avatar image fails to load |
Date: |
Wed, 21 Sep 2022 14:57:49 -0400 (EDT) |
branch: externals/ement
commit e046f66ba2c1c3c6be2ce64d8955af0c42458a02
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Fix: (ement-room-list--entry) When room avatar image fails to load
Thanks to @trevdev:matrix.org for reporting.
---
README.org | 1 +
ement-room-list.el | 23 +++++++++++++++--------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/README.org b/README.org
index f251568323..bd43e6759c 100644
--- a/README.org
+++ b/README.org
@@ -288,6 +288,7 @@ Note that, while ~matrix-client~ remains usable, and
probably will for some time
*Fixes*
+ Links to only rooms (as opposed to links to events in rooms) may be
activated to join them.
+ Read receipts mark the last completely visible event (rather than one that's
only partially displayed).
++ Prevent error when a room avatar image fails to load.
** 0.1.4
diff --git a/ement-room-list.el b/ement-room-list.el
index 7b33410e41..b95efd3fe3 100644
--- a/ement-room-list.el
+++ b/ement-room-list.el
@@ -334,15 +334,22 @@ To be called in `ement-sync-callback-hook'."
(e-unread (if (and buffer (buffer-modified-p buffer))
(propertize "U" 'help-echo "Unread") ""))
(e-buffer (if buffer (propertize "B" 'help-echo "Room has
buffer") ""))
- (e-avatar (if (and ement-room-list-avatars avatar)
+ (e-avatar (if ement-room-list-avatars
(or room-list-avatar
- (let ((new-avatar (propertize " " 'display
-
(ement--resize-image (get-text-property 0 'display avatar)
-
nil (frame-char-height)))))
- ;; alist-get doesn't seem to return the new
value when used with setf?
- (setf (alist-get 'room-list-avatar
(ement-room-local room))
- new-avatar)
- new-avatar))
+ (if-let* ((avatar-image (get-text-property 0
'display avatar))
+ (new-avatar-string (propertize " "
'display
+
(ement--resize-image avatar-image
+
nil (frame-char-height)))))
+ (progn
+ ;; alist-get doesn't seem to return the
new value when used with setf?
+ (setf (alist-get 'room-list-avatar
(ement-room-local room))
+ new-avatar-string)
+ new-avatar-string)
+ ;; If a room avatar image fails to download
or decode
+ ;; and ends up nil, we return the empty
string.
+ (ement-debug "nil avatar for room: "
(ement-room-display-name room) (ement-room-canonical-alias room))
+ ""))
+ ;; Room avatars disabled.
""))
;; We have to copy the list, otherwise using `setf' on it
;; later causes its value to be mutated for every entry.