branch: externals/ement
commit 2349b91eb3106f9a550940471b982802ebc05ed9
Author: Steven Allen <ste...@stebalien.com>
Commit: Adam Porter <a...@alphapapa.net>

    Fix room list display with empty notification actions
    
    Parse actions according to
    https://spec.matrix.org/v1.7/client-server-api/#actions, allowing for 0
    or more actions in any order.
    
    fixes #181
---
 ement-lib.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ement-lib.el b/ement-lib.el
index 985523d1de..0138101381 100644
--- a/ement-lib.el
+++ b/ement-lib.el
@@ -597,12 +597,12 @@ Returns one of nil (meaning default rules are used), 
`all-loud',
                                          (equal "room_id" key)
                                          (equal (ement-room-id room) 
pattern)))))
                 (mute-rule-p
-                 (rule) (and (= 1 (length (alist-get 'actions rule)))
-                             (equal "dont_notify" (elt (alist-get 'actions 
rule) 0))))
+                 (rule) (when-let ((actions (alist-get 'actions rule)))
+                          (seq-contains-p actions "dont_notify")))
                 (tweak-rule-p
-                 (type rule) (pcase-let (((map ('actions `[,action ,alist])) 
rule))
-                               (and (equal "notify" action)
-                                    (equal type (alist-get 'set_tweak 
alist))))))
+                 (type rule) (when-let ((actions (alist-get 'actions rule)))
+                               (and (seq-contains-p actions "notify")
+                                    (seq-contains-p actions `(set_tweak . 
,type) 'seq-contains-p)))))
       ;; If none of these match, nil is returned, meaning that the default 
rule is used
       ;; for the room.
       (if (override-mute-rule-for-room-p room)

Reply via email to