branch: externals/ement commit bbf052ab43bce2bf1d6c8a5d068402fd1c67ef63 Author: Adam Porter <a...@alphapapa.net> Commit: Adam Porter <a...@alphapapa.net>
Fix: (ement-room-edit-message) Already edited events Fixes #126. --- README.org | 1 + ement-room.el | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.org b/README.org index 08ef48d3f0..270beae13b 100644 --- a/README.org +++ b/README.org @@ -307,6 +307,7 @@ Note that, while ~matrix-client~ remains usable, and probably will for some time + Command ~ement-room-image-show~ is not used for mouse events. *Fixes* ++ Allow editing of already-edited events. + Don't stop syncing if an error is signaled while sending a notification. ** 0.10 diff --git a/ement-room.el b/ement-room.el index 776e50e413..f8a0647a1d 100644 --- a/ement-room.el +++ b/ement-room.el @@ -1646,16 +1646,15 @@ The message must be one sent by the local user." (interactive (ement-room-with-highlighted-event-at (point) (cl-assert ement-session) (cl-assert ement-room) (pcase-let* ((event (ewoc-data (ewoc-locate ement-ewoc))) - ((cl-struct ement-session user) ement-session) - ((cl-struct ement-event sender + ((cl-struct ement-session user events) ement-session) + ((cl-struct ement-event sender id (content (map body ('m.relates_to relates-to)))) event)) (unless (equal (ement-user-id sender) (ement-user-id user)) (user-error "You may only edit your own messages")) (when relates-to - ;; FIXME: This isn't quite right. When we show edits by replacing - ;; the original event, this will need to be changed. - (user-error "Only original messages may be edited, not the edit events themselves")) + ;; Editing an already-edited event: get the original event. + (setf event (gethash id events))) ;; Remove any leading asterisk from the plain-text body. (setf body (replace-regexp-in-string (rx bos "*" (1+ space)) "" body t t)) (ement-room-with-typing