branch: externals/ement
commit 4e9edb9b5a4194bd02fd2f821df35e30b66bf99c
Author: Adam Porter <[email protected]>
Commit: Adam Porter <[email protected]>
Fix: (ement-room-retro) Don't send empty "from" token
After joining a room, but without having received an initial sync
response including its events, we have no "from" token, in which case
we should omit it rather than sending an empty value for it.
See #148.
---
ement-room.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/ement-room.el b/ement-room.el
index 12614fad8c..563ad70dc0 100644
--- a/ement-room.el
+++ b/ement-room.el
@@ -1884,10 +1884,12 @@ see."
;; We use a timeout of 30, because sometimes the server can take a while
to
;; respond, especially if loading, e.g. hundreds or thousands of events.
(ement-api session endpoint :timeout 30
- :params (list (list "from" prev-batch)
- (list "dir" "b")
- (list "limit" (number-to-string number))
- (list "filter" (json-encode ement-room-messages-filter)))
+ :params (remq nil
+ (list (when prev-batch
+ (list "from" prev-batch))
+ (list "dir" "b")
+ (list "limit" (number-to-string number))
+ (list "filter" (json-encode
ement-room-messages-filter))))
:then then
:else (lambda (plz-error)
(when buffer