Fix handling updates to multipart messages
This commit is contained in:
parent
a947eddcee
commit
53e992c25d
1 changed files with 11 additions and 8 deletions
19
portal.go
19
portal.go
|
@ -507,15 +507,9 @@ func (portal *Portal) handleExistingMessageUpdate(ctx context.Context, source *U
|
|||
if chatIDChanged {
|
||||
isEdit = false
|
||||
} else if i == 0 {
|
||||
part.Content.SetEdit(dbMsg.MXID)
|
||||
part.Extra = map[string]any{
|
||||
"m.new_content": part.Extra,
|
||||
}
|
||||
part.SetEdit(dbMsg.MXID)
|
||||
} else if existingPart, ok := dbMsg.Status.MediaParts[part.ID]; ok {
|
||||
part.Content.SetEdit(existingPart.EventID)
|
||||
part.Extra = map[string]any{
|
||||
"m.new_content": part.Extra,
|
||||
}
|
||||
part.SetEdit(existingPart.EventID)
|
||||
} else {
|
||||
ts = converted.Timestamp.UnixMilli()
|
||||
isEdit = false
|
||||
|
@ -790,6 +784,15 @@ type ConvertedMessagePart struct {
|
|||
Extra map[string]any
|
||||
}
|
||||
|
||||
func (cmp *ConvertedMessagePart) SetEdit(eventID id.EventID) {
|
||||
cmp.Content.SetEdit(eventID)
|
||||
if cmp.Extra != nil {
|
||||
cmp.Extra = map[string]any{
|
||||
"m.new_content": cmp.Extra,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type ConvertedMessage struct {
|
||||
ID string
|
||||
SenderID string
|
||||
|
|
Loading…
Reference in a new issue