aboutsummaryrefslogtreecommitdiff
path: root/ui/tag-room-list.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-03-03 20:58:33 +0200
committerTulir Asokan <tulir@maunium.net>2020-03-03 20:58:33 +0200
commit27ecb48e2311ad46c266f36c1646c19832c4c7f4 (patch)
tree8d4a87e1f2c59e374bcc4d62f753fb976b1c73cb /ui/tag-room-list.go
parent43212996e9486c40402d36d1c64071f696f2c683 (diff)
More small changes to room list
Diffstat (limited to 'ui/tag-room-list.go')
-rw-r--r--ui/tag-room-list.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/tag-room-list.go b/ui/tag-room-list.go
index ca24d4e..3bea033 100644
--- a/ui/tag-room-list.go
+++ b/ui/tag-room-list.go
@@ -170,7 +170,10 @@ func almostEqual(a, b float64) bool {
// ShouldBeAfter returns if the first room should be after the second room in the room list.
// The manual order and last received message timestamp are considered.
func (trl *TagRoomList) ShouldBeAfter(room1 *OrderedRoom, room2 *OrderedRoom) bool {
- return room1.order > room2.order || (almostEqual(room1.order, room2.order) && room2.LastReceivedMessage.After(room1.LastReceivedMessage))
+ // Lower order value = higher in list
+ return room1.order > room2.order ||
+ // Equal order value and more recent message = higher in the list
+ (almostEqual(room1.order, room2.order) && room2.LastReceivedMessage.After(room1.LastReceivedMessage))
}
func (trl *TagRoomList) Insert(order json.Number, mxRoom *rooms.Room) {