Archived
1
0
Disbranĉigi 0

Correctly sort messages sent in the same second

This commit is contained in:
Jaidyn Ann 2023-06-07 16:06:08 -05:00
parent 8a94a0fa82
commit 79abf15fa8

View File

@ -70,11 +70,11 @@
"") "")
"")] "")]
[message-time [message-time
(if last-message (if last-message
(date->string (alist-ref 'user.chat.date (date->string (alist-ref 'user.chat.date
(cdr last-message)) (cdr last-message))
"[~H:~M:~S]") "[~H:~M:~S]")
"")]) "")])
(html-from-template (html-from-template
"templates/room-list-item.html" "templates/room-list-item.html"
`(("ROOM_TITLE" . ,(html-encode-string room)) `(("ROOM_TITLE" . ,(html-encode-string room))
@ -113,8 +113,16 @@
(sort (sort
(channel-messages irc-dir channel) (channel-messages irc-dir channel)
(lambda (a b) (lambda (a b)
(date>? (alist-ref 'user.chat.date (cdr a)) (let ([date-a (alist-ref 'user.chat.date (cdr a))]
(alist-ref 'user.chat.date (cdr b)))))) [nano-a (alist-ref 'user.chat.date.nanoseconds (cdr a))]
[date-b (alist-ref 'user.chat.date (cdr b))]
[nano-b (alist-ref 'user.chat.date.nanoseconds (cdr b))])
(cond [(and (date=? date-a date-b)
nano-a nano-b)
(> (string->number nano-b)
(string->number nano-a))]
[#t
(date<? date-b date-a)])))))
(define (channel-online-users irc-dir channel) (define (channel-online-users irc-dir channel)