forked from Mirrors/gomuks
hicli/sync: fix updating preview event rowid on redaction
This commit is contained in:
parent
7f80301276
commit
0ed5dfcc12
2 changed files with 3 additions and 3 deletions
|
@ -80,7 +80,7 @@ const (
|
||||||
AND (type IN ('m.room.message', 'm.sticker')
|
AND (type IN ('m.room.message', 'm.sticker')
|
||||||
OR (type = 'm.room.encrypted'
|
OR (type = 'm.room.encrypted'
|
||||||
AND decrypted_type IN ('m.room.message', 'm.sticker')))
|
AND decrypted_type IN ('m.room.message', 'm.sticker')))
|
||||||
AND relation_type <> 'm.replace'
|
AND (relation_type IS NULL OR relation_type <> 'm.replace')
|
||||||
AND redacted_by IS NULL
|
AND redacted_by IS NULL
|
||||||
ORDER BY timestamp DESC
|
ORDER BY timestamp DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
@ -215,7 +215,7 @@ func (r *Room) CheckChangesAndCopyInto(other *Room) (hasChanges bool) {
|
||||||
hasChanges = true
|
hasChanges = true
|
||||||
other.HasMemberList = true
|
other.HasMemberList = true
|
||||||
}
|
}
|
||||||
if r.PreviewEventRowID > other.PreviewEventRowID {
|
if r.PreviewEventRowID != 0 {
|
||||||
other.PreviewEventRowID = r.PreviewEventRowID
|
other.PreviewEventRowID = r.PreviewEventRowID
|
||||||
hasChanges = true
|
hasChanges = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -785,7 +785,7 @@ func (h *HiClient) processStateAndTimeline(
|
||||||
return fmt.Errorf("failed to get relation target of redaction target: %w", err)
|
return fmt.Errorf("failed to get relation target of redaction target: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if updatedRoom.PreviewEventRowID == dbEvt.RowID {
|
if updatedRoom.PreviewEventRowID == dbEvt.RowID || (updatedRoom.PreviewEventRowID == 0 && room.PreviewEventRowID == dbEvt.RowID) {
|
||||||
updatedRoom.PreviewEventRowID = 0
|
updatedRoom.PreviewEventRowID = 0
|
||||||
recalculatePreviewEvent = true
|
recalculatePreviewEvent = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue