Skip to main content

check_validity_of_replacement_events

Function check_validity_of_replacement_events 

pub fn check_validity_of_replacement_events(
    original_json: &Raw<AnySyncTimelineEvent>,
    original_encryption_info: Option<&EncryptionInfo>,
    replacement_json: &Raw<AnySyncTimelineEvent>,
    replacement_encryption_info: Option<&EncryptionInfo>,
) -> Result<(), EditValidityError>
Expand description

This implements the Matrix spec rule set for validity of replacement events (edits). Invalid replacements must be ignored.

This function implements the steps documented in the spec with one exception, the step to check if the room IDs match isn’t done. The JSON of the event might not contain the room ID if it wasn received over a /sync request.

Warning: Callers must ensure that the original event and replacement event belong to the same room, that is, they have the same room ID.