Add support for suppress edits push rule
According to MSC3958
This commit is contained in:
		
							parent
							
								
									369cf8629e
								
							
						
					
					
						commit
						31ae99cf52
					
				@ -27,6 +27,7 @@ Improvements:
 | 
				
			|||||||
- Add `MatrixVersion::V1_7` and `MatrixVersion::V1_8`
 | 
					- Add `MatrixVersion::V1_7` and `MatrixVersion::V1_8`
 | 
				
			||||||
- Add support for room version 11 according to MSC3820 / Matrix 1.8
 | 
					- Add support for room version 11 according to MSC3820 / Matrix 1.8
 | 
				
			||||||
  - Adapt the redaction algorithm in `canonical_json`
 | 
					  - Adapt the redaction algorithm in `canonical_json`
 | 
				
			||||||
 | 
					- Add unstable support for suppress edits push rule (MSC3958)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# 0.11.3
 | 
					# 0.11.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,7 @@ unstable-msc2870 = []
 | 
				
			|||||||
unstable-msc3381 = []
 | 
					unstable-msc3381 = []
 | 
				
			||||||
unstable-msc3931 = []
 | 
					unstable-msc3931 = []
 | 
				
			||||||
unstable-msc3932 = ["unstable-msc3931"]
 | 
					unstable-msc3932 = ["unstable-msc3931"]
 | 
				
			||||||
 | 
					unstable-msc3958 = []
 | 
				
			||||||
unstable-unspecified = []
 | 
					unstable-unspecified = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Don't validate the version part in `KeyId`.
 | 
					# Don't validate the version part in `KeyId`.
 | 
				
			||||||
 | 
				
			|||||||
@ -40,6 +40,8 @@ impl Ruleset {
 | 
				
			|||||||
                ConditionalPushRule::tombstone(),
 | 
					                ConditionalPushRule::tombstone(),
 | 
				
			||||||
                ConditionalPushRule::reaction(),
 | 
					                ConditionalPushRule::reaction(),
 | 
				
			||||||
                ConditionalPushRule::server_acl(),
 | 
					                ConditionalPushRule::server_acl(),
 | 
				
			||||||
 | 
					                #[cfg(feature = "unstable-msc3958")]
 | 
				
			||||||
 | 
					                ConditionalPushRule::suppress_edits(),
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
            .into(),
 | 
					            .into(),
 | 
				
			||||||
            underride: [
 | 
					            underride: [
 | 
				
			||||||
@ -306,6 +308,23 @@ impl ConditionalPushRule {
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// Matches [event replacements].
 | 
				
			||||||
 | 
					    ///
 | 
				
			||||||
 | 
					    /// [event replacements]: https://spec.matrix.org/latest/client-server-api/#event-replacements
 | 
				
			||||||
 | 
					    #[cfg(feature = "unstable-msc3958")]
 | 
				
			||||||
 | 
					    pub fn suppress_edits() -> Self {
 | 
				
			||||||
 | 
					        Self {
 | 
				
			||||||
 | 
					            actions: vec![],
 | 
				
			||||||
 | 
					            default: true,
 | 
				
			||||||
 | 
					            enabled: true,
 | 
				
			||||||
 | 
					            rule_id: PredefinedOverrideRuleId::SuppressEdits.to_string(),
 | 
				
			||||||
 | 
					            conditions: vec![EventPropertyIs {
 | 
				
			||||||
 | 
					                key: r"content.m\.relates_to.rel_type".to_owned(),
 | 
				
			||||||
 | 
					                value: "m.replace".into(),
 | 
				
			||||||
 | 
					            }],
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Default content push rules
 | 
					/// Default content push rules
 | 
				
			||||||
@ -535,6 +554,11 @@ pub enum PredefinedOverrideRuleId {
 | 
				
			|||||||
    #[ruma_enum(rename = ".m.rule.room.server_acl")]
 | 
					    #[ruma_enum(rename = ".m.rule.room.server_acl")]
 | 
				
			||||||
    RoomServerAcl,
 | 
					    RoomServerAcl,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /// `.m.rule.suppress_edits`
 | 
				
			||||||
 | 
					    #[cfg(feature = "unstable-msc3958")]
 | 
				
			||||||
 | 
					    #[ruma_enum(rename = ".org.matrix.msc3958.suppress_edits")]
 | 
				
			||||||
 | 
					    SuppressEdits,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[doc(hidden)]
 | 
					    #[doc(hidden)]
 | 
				
			||||||
    _Custom(PrivOwnedStr),
 | 
					    _Custom(PrivOwnedStr),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -199,6 +199,7 @@ unstable-msc3932 = ["ruma-common/unstable-msc3932"]
 | 
				
			|||||||
unstable-msc3954 = ["ruma-events?/unstable-msc3954"]
 | 
					unstable-msc3954 = ["ruma-events?/unstable-msc3954"]
 | 
				
			||||||
unstable-msc3955 = ["ruma-events?/unstable-msc3955"]
 | 
					unstable-msc3955 = ["ruma-events?/unstable-msc3955"]
 | 
				
			||||||
unstable-msc3956 = ["ruma-events?/unstable-msc3956"]
 | 
					unstable-msc3956 = ["ruma-events?/unstable-msc3956"]
 | 
				
			||||||
 | 
					unstable-msc3958 = ["ruma-common/unstable-msc3958"]
 | 
				
			||||||
unstable-pdu = ["ruma-events?/unstable-pdu"]
 | 
					unstable-pdu = ["ruma-events?/unstable-pdu"]
 | 
				
			||||||
unstable-unspecified = [
 | 
					unstable-unspecified = [
 | 
				
			||||||
    "ruma-common/unstable-unspecified",
 | 
					    "ruma-common/unstable-unspecified",
 | 
				
			||||||
@ -239,6 +240,7 @@ __ci = [
 | 
				
			|||||||
    "unstable-msc3954",
 | 
					    "unstable-msc3954",
 | 
				
			||||||
    "unstable-msc3955",
 | 
					    "unstable-msc3955",
 | 
				
			||||||
    "unstable-msc3956",
 | 
					    "unstable-msc3956",
 | 
				
			||||||
 | 
					    "unstable-msc3958",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user