mirror of https://github.com/vector-im/riot-web
				
				
				
			Merge pull request #2330 from matrix-org/travis/fix-pinned-rooms
Fix pinning of rooms without badgespull/21833/head
						commit
						d7319d7e4f
					
				|  | @ -300,6 +300,10 @@ class RoomListStore extends Store { | |||
|             const ts = this._tsOfNewestEvent(room); | ||||
|             this._updateCachedRoomState(roomId, "timestamp", ts); | ||||
|             return ts; | ||||
|         } else if (type === "unread-muted") { | ||||
|             const unread = Unread.doesRoomHaveUnreadMessages(room); | ||||
|             this._updateCachedRoomState(roomId, "unread-muted", unread); | ||||
|             return unread; | ||||
|         } else if (type === "unread") { | ||||
|             const unread = room.getUnreadNotificationCount() > 0; | ||||
|             this._updateCachedRoomState(roomId, "unread", unread); | ||||
|  | @ -358,8 +362,21 @@ class RoomListStore extends Store { | |||
|         } | ||||
| 
 | ||||
|         if (pinUnread) { | ||||
|             const unreadA = this._getRoomState(roomA, "unread"); | ||||
|             const unreadB = this._getRoomState(roomB, "unread"); | ||||
|             let unreadA = this._getRoomState(roomA, "unread"); | ||||
|             let unreadB = this._getRoomState(roomB, "unread"); | ||||
|             if (unreadA && !unreadB) return -1; | ||||
|             if (!unreadA && unreadB) return 1; | ||||
| 
 | ||||
|             // If they both have unread messages, sort by timestamp
 | ||||
|             // If nether have unread message (the fourth check not shown
 | ||||
|             // here), then just sort by timestamp anyways.
 | ||||
|             if (unreadA && unreadB) return timestampDiff; | ||||
| 
 | ||||
|             // Unread can also mean "unread without badge", which is
 | ||||
|             // different from what the above checks for. We're also
 | ||||
|             // going to sort those here.
 | ||||
|             unreadA = this._getRoomState(roomA, "unread-muted"); | ||||
|             unreadB = this._getRoomState(roomB, "unread-muted"); | ||||
|             if (unreadA && !unreadB) return -1; | ||||
|             if (!unreadA && unreadB) return 1; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 David Baker
						David Baker