forked from Mirrors/gomuks
hicli/sync: fill prev_content with cached event if it's missing
This commit is contained in:
parent
bd2ece9ff2
commit
0c3d3686e4
1 changed files with 8 additions and 0 deletions
|
@ -613,6 +613,14 @@ func (h *HiClient) processEvent(
|
|||
return dbEvt, nil
|
||||
}
|
||||
}
|
||||
if evt.StateKey != nil && evt.Unsigned.PrevContent == nil && evt.Unsigned.ReplacesState != "" {
|
||||
replacesState, err := h.DB.Event.GetByID(ctx, evt.Unsigned.ReplacesState)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get prev content for %s from %s: %w", evt.ID, evt.Unsigned.ReplacesState, err)
|
||||
} else if replacesState != nil {
|
||||
evt.Unsigned.PrevContent = &event.Content{VeryRaw: replacesState.Content}
|
||||
}
|
||||
}
|
||||
dbEvt := database.MautrixToEvent(evt)
|
||||
contentWithoutFallback := removeReplyFallback(evt)
|
||||
if contentWithoutFallback != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue