Add redact method to all event_enum! generated enums#138
Add redact method to all event_enum! generated enums#138jplatte merged 8 commits intoruma:masterfrom
Conversation
I thought about that when proposing these methods, but I feel that it would actually be worse because any code calling this will already have to look for the correct event to apply the redaction to so would end up
I don't see how. |
ruma-events/src/room/aliases.rs
Outdated
| pub fn redact_v1(self) -> RedactedAliasesEventContent { | ||
| RedactedAliasesEventContent { aliases: Some(self.aliases) } | ||
| pub fn redact(self, version: RoomVersionId) -> RedactedAliasesEventContent { | ||
| if version.is_version_6() { |
There was a problem hiding this comment.
I wonder how we should be handling custom room versions. I thought I had read somewhere that they should generally be considered following the latest room version rules, so this would have to include || version.is_custom(). But I can't find that. Will ask #matrix-spec. But we should still invert this logic so when a new version is introduced, this doesn't revert back to v1 behaviour for that version. Since it's then going to be easier to have custom == v6 logic, let's do that.
|
Yes much better! Thanks |
I did some commit manipulation on this I think I'm getting the hang of it!
What do you think of
redactreturning anOption<RedactedEvent>, the method can validate theEventIds match and whatever else is needed (I think the event ids are it but maybe in the future it could be more complicated)?