projects
/
ssh-chat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
chat/message: Fix RecentActiveUsers sort order
[ssh-chat]
/
chat
/
message
/
user.go
diff --git
a/chat/message/user.go
b/chat/message/user.go
index 0fc8cc18ec6a22d647af5369c016737fc5e27253..d4cc304c539c995076dcc27e02dba1adefc84538 100644
(file)
--- a/
chat/message/user.go
+++ b/
chat/message/user.go
@@
-258,5
+258,11
@@
func (a RecentActiveUsers) Less(i, j int) bool {
defer a[i].mu.Unlock()
a[j].mu.Lock()
defer a[j].mu.Unlock()
- return a[i].lastMsg.After(a[j].lastMsg)
+
+ if a[i].lastMsg.IsZero() {
+ return a[i].joined.Before(a[j].joined)
+ } else {
+ return a[i].lastMsg.Before(a[j].lastMsg)
+ }
+
}