diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-02-20 01:10:26 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-02-20 01:10:26 +0200 |
commit | db7d2da50cd0f4c20bc0966bff7c388c017e182f (patch) | |
tree | 0b7c450f0df7d912a9c30354ed84197a9931582d /ui | |
parent | 8a0a3a6487bafbbcd3e0ae630b7ba95bf8ce76ce (diff) |
Hide tombstoned rooms from room list
Diffstat (limited to 'ui')
-rw-r--r-- | ui/fuzzy-search-modal.go | 5 | ||||
-rw-r--r-- | ui/room-list.go | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/ui/fuzzy-search-modal.go b/ui/fuzzy-search-modal.go index 97a029a..9f91877 100644 --- a/ui/fuzzy-search-modal.go +++ b/ui/fuzzy-search-modal.go @@ -89,6 +89,10 @@ func (fs *FuzzySearchModal) Blur() { func (fs *FuzzySearchModal) InitList(rooms map[string]*RoomView) { for _, room := range rooms { + if room.Room.IsReplaced() { + //if _, ok := rooms[room.Room.ReplacedBy()]; ok + continue + } fs.roomList = append(fs.roomList, room.Room) fs.roomTitles = append(fs.roomTitles, room.Room.GetTitle()) } @@ -134,6 +138,7 @@ func (fs *FuzzySearchModal) OnKeyEvent(event mauview.KeyEvent) bool { fs.results.Highlight(strconv.Itoa(fs.matches[fs.selected].OriginalIndex)) fs.results.ScrollToHighlight() } + return true case tcell.KeyEnter: // Switch room to currently selected room if len(highlights) > 0 { diff --git a/ui/room-list.go b/ui/room-list.go index b6fc612..2b8af87 100644 --- a/ui/room-list.go +++ b/ui/room-list.go @@ -88,7 +88,11 @@ func (list *RoomList) Contains(roomID string) bool { } func (list *RoomList) Add(room *rooms.Room) { - debug.Print("Adding room to list", room.ID, room.GetTitle(), room.IsDirect, room.Tags()) + if room.IsReplaced() { + debug.Print(room.ID, "is replaced by", room.ReplacedBy(), "-> not adding to room list") + return + } + debug.Print("Adding room to list", room.ID, room.GetTitle(), room.IsDirect, room.ReplacedBy(), room.Tags()) for _, tag := range room.Tags() { list.AddToTag(tag, room) } |