Fix selecting other users' messages

This commit is contained in:
Tulir Asokan 2020-03-06 10:53:23 +02:00
parent 5db5cd550d
commit 5a2c74514d

View File

@ -478,9 +478,7 @@ func (view *RoomView) findMessage(current *event.Event, ownMessage, forward bool
if evt.EventID == "" || evt.EventID == evt.TxnID || evt.IsService { if evt.EventID == "" || evt.EventID == evt.TxnID || evt.IsService {
continue continue
} else if currentFound { } else if currentFound {
if ownMessage && evt.SenderID == self && evt.Event.Type == mautrix.EventMessage { if !ownMessage || (evt.SenderID == self && evt.Event.Type == mautrix.EventMessage) {
return evt
} else if !ownMessage {
return evt return evt
} }
} else if evt.EventID == current.ID { } else if evt.EventID == current.ID {
@ -513,7 +511,7 @@ func (view *RoomView) SelectNext() {
if msgView.selected == nil { if msgView.selected == nil {
return return
} }
foundMsg := view.findMessage(msgView.selected.GetEvent(), true, true) foundMsg := view.findMessage(msgView.selected.GetEvent(), false, true)
if foundMsg != nil { if foundMsg != nil {
msgView.SetSelected(foundMsg) msgView.SetSelected(foundMsg)
// TODO scroll selected message into view // TODO scroll selected message into view
@ -522,7 +520,7 @@ func (view *RoomView) SelectNext() {
func (view *RoomView) SelectPrevious() { func (view *RoomView) SelectPrevious() {
msgView := view.MessageView() msgView := view.MessageView()
foundMsg := view.findMessage(msgView.selected.GetEvent(), true, false) foundMsg := view.findMessage(msgView.selected.GetEvent(), false, false)
if foundMsg != nil { if foundMsg != nil {
msgView.SetSelected(foundMsg) msgView.SetSelected(foundMsg)
// TODO scroll selected message into view // TODO scroll selected message into view