Fix unexpected results when clicking some message senders

This commit is contained in:
Tulir Asokan 2020-02-22 03:04:44 +02:00
parent 58fff45d69
commit a79de7ba76

View File

@ -358,14 +358,16 @@ func (view *MessageView) handleMessageClick(message *messages.UIMessage, mod tce
} }
func (view *MessageView) handleUsernameClick(message *messages.UIMessage, prevMessage *messages.UIMessage) bool { func (view *MessageView) handleUsernameClick(message *messages.UIMessage, prevMessage *messages.UIMessage) bool {
if prevMessage != nil && prevMessage.Sender() == message.Sender() { // TODO this is needed if senders are hidden for messages from the same sender (see Draw method)
//if prevMessage != nil && prevMessage.SenderName == message.SenderName {
// return false
//}
if message.SenderName == "---" || message.SenderName == "-->" || message.SenderName == "<--" || message.Type == mautrix.MsgEmote {
return false return false
} }
if len(message.Sender()) == 0 { sender := fmt.Sprintf("[%s](https://matrix.to/#/%s)", message.SenderName, message.SenderID)
return false
}
sender := fmt.Sprintf("[%s](https://matrix.to/#/%s)", message.Sender(), message.SenderID)
cursorPos := view.parent.input.GetCursorOffset() cursorPos := view.parent.input.GetCursorOffset()
text := view.parent.input.GetText() text := view.parent.input.GetText()