From 58fff45d69717a9e78d127505527e541e22d3cff Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 22 Feb 2020 02:56:10 +0200 Subject: [PATCH] Add separate messages for invite reject/accept --- ui/messages/parser.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/messages/parser.go b/ui/messages/parser.go index c242f47..e4bbc30 100644 --- a/ui/messages/parser.go +++ b/ui/messages/parser.go @@ -158,7 +158,11 @@ func getMembershipChangeMessage(evt *event.Event, membership, prevMembership mau text.Colorize(len(senderDisplayname)+len(" invited "), len(displayname), widget.GetHashColor(*evt.StateKey)) case "join": 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)) case "leave": sender = "<--" @@ -175,7 +179,11 @@ func getMembershipChangeMessage(evt *event.Event, membership, prevMembership mau if displayname == *evt.StateKey { 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)) } case "ban":