Skip to content

Commit

Permalink
WIP: Old events can't be loaded after joining a room
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Sainty committed Aug 14, 2023
1 parent ae66636 commit 3a7b517
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ement-room.el
Original file line number Diff line number Diff line change
Expand Up @@ -1376,16 +1376,17 @@ see."
(list (read-number "Number of messages: "))
(number current-prefix-arg))
:buffer (current-buffer)))
(unless ement-room-retro-loading
(unless (or ement-room-retro-loading (not room))
(pcase-let* (((cl-struct ement-room id prev-batch) room)
(endpoint (format "rooms/%s/messages" (url-hexify-string id))))
;; 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 (nconc (and prev-batch
(list (list "from" prev-batch)))
(list (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
Expand Down

0 comments on commit 3a7b517

Please sign in to comment.