Add separate messages for invite reject/accept

This commit is contained in:
Tulir Asokan 2020-02-22 02:56:10 +02:00
parent 452b3d9cf9
commit 58fff45d69

View File

@ -158,7 +158,11 @@ func getMembershipChangeMessage(evt *event.Event, membership, prevMembership mau
text.Colorize(len(senderDisplayname)+len(" invited "), len(displayname), widget.GetHashColor(*evt.StateKey)) text.Colorize(len(senderDisplayname)+len(" invited "), len(displayname), widget.GetHashColor(*evt.StateKey))
case "join": case "join":
sender = "-->" sender = "-->"
text = tstring.NewColorTString(fmt.Sprintf("%s joined the room.", displayname), tcell.ColorGreen) if prevMembership == mautrix.MembershipInvite {
text = tstring.NewColorTString(fmt.Sprintf("%s accepted the invite.", displayname), tcell.ColorGreen)
} else {
text = tstring.NewColorTString(fmt.Sprintf("%s joined the room.", displayname), tcell.ColorGreen)
}
text.Colorize(0, len(displayname), widget.GetHashColor(*evt.StateKey)) text.Colorize(0, len(displayname), widget.GetHashColor(*evt.StateKey))
case "leave": case "leave":
sender = "<--" sender = "<--"
@ -175,7 +179,11 @@ func getMembershipChangeMessage(evt *event.Event, membership, prevMembership mau
if displayname == *evt.StateKey { if displayname == *evt.StateKey {
displayname = prevDisplayname displayname = prevDisplayname
} }
text = tstring.NewColorTString(fmt.Sprintf("%s left the room.", displayname), tcell.ColorRed) if prevMembership == mautrix.MembershipInvite {
text = tstring.NewColorTString(fmt.Sprintf("%s rejected the invite.", displayname), tcell.ColorRed)
} else {
text = tstring.NewColorTString(fmt.Sprintf("%s left the room.", displayname), tcell.ColorRed)
}
text.Colorize(0, len(displayname), widget.GetHashColor(*evt.StateKey)) text.Colorize(0, len(displayname), widget.GetHashColor(*evt.StateKey))
} }
case "ban": case "ban":