diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-02-19 01:14:02 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-02-19 01:14:02 +0200 |
commit | d02abd079fe58bae467672dc7d2a140f9f07bb85 (patch) | |
tree | 7972380c8aad12a3571aee7065ba450433c260dc /ui/messages | |
parent | b4e27723d7ad6287d34f4cfc1f5a15b0074b59d1 (diff) |
Add support for editing messages
Diffstat (limited to 'ui/messages')
-rw-r--r-- | ui/messages/base.go | 5 | ||||
-rw-r--r-- | ui/messages/parser.go | 1 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ui/messages/base.go b/ui/messages/base.go index 567e614..b54691e 100644 --- a/ui/messages/base.go +++ b/ui/messages/base.go @@ -17,7 +17,6 @@ package messages import ( - "encoding/json" "fmt" "time" @@ -55,7 +54,7 @@ type UIMessage struct { IsHighlight bool IsService bool Edited bool - Source json.RawMessage + Event *event.Event ReplyTo *UIMessage Renderer MessageRenderer } @@ -82,7 +81,7 @@ func newUIMessage(evt *event.Event, displayname string, renderer MessageRenderer IsHighlight: false, IsService: false, Edited: len(evt.Gomuks.Edits) > 0, - Source: evt.Content.VeryRaw, + Event: evt, Renderer: renderer, } } diff --git a/ui/messages/parser.go b/ui/messages/parser.go index e1c0053..53d30e3 100644 --- a/ui/messages/parser.go +++ b/ui/messages/parser.go @@ -128,6 +128,7 @@ func ParseMessage(matrix ifc.MatrixContainer, room *rooms.Room, evt *event.Event evt.Content.RemoveReplyFallback() } if len(evt.Gomuks.Edits) > 0 { + evt = evt.SomewhatDangerousCopy() evt.Content = *evt.Gomuks.Edits[len(evt.Gomuks.Edits)-1].Content.NewContent } switch evt.Content.MsgType { |