From db7d2da50cd0f4c20bc0966bff7c388c017e182f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 20 Feb 2020 01:10:26 +0200 Subject: Hide tombstoned rooms from room list --- ui/fuzzy-search-modal.go | 5 +++++ ui/room-list.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'ui') 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) } -- cgit v1.2.3