Hide tombstoned rooms from room list

This commit is contained in:
Tulir Asokan
2020-02-20 01:10:26 +02:00
parent 8a0a3a6487
commit db7d2da50c
5 changed files with 41 additions and 7 deletions

View File

@ -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 {

View File

@ -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)
}