-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add redact method to all event_enum! generated enums #138
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
redact
returning anOption<RedactedEvent>
, the method can validate theEventId
s match and whatever else is needed (I think the event ids are it but maybe in the future it could be more complicated)?