Skip to content

Revert " Remove event_enum! and only use event_content_enum"#68

Merged
jplatte merged 5 commits into
ruma:masterfrom
DevinR528:revert-content
Jun 19, 2020
Merged

Revert " Remove event_enum! and only use event_content_enum"#68
jplatte merged 5 commits into
ruma:masterfrom
DevinR528:revert-content

Conversation

@DevinR528

Copy link
Copy Markdown
Member

No description provided.

Move EventDeHelper and from_raw_json_value to lib make pub so event_enum! macro can use them and test.  to_camel_case returns a syn::Result.
@DevinR528 DevinR528 changed the title Revert content Revert " Remove event_enum! and only use event_content_enum" Jun 18, 2020
Comment thread ruma-events-macros/src/content_enum.rs Outdated
Comment thread ruma-events-macros/src/event_enum.rs
Comment thread ruma-events/src/enums.rs
pub type AnyMessageEvent = MessageEvent<AnyMessageEventContent>;

/// Any message event stub (message event without a `room_id`, as returned in `/sync` responses)
pub type AnyMessageEventStub = MessageEventStub<AnyMessageEventContent>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess we do need the marker trait implementations... For now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning on removing the Any*EventContent enums? An event that has a prev_content is still possible right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Any*EventContent enums are needed when sending events. I don't think they're needed as the C in GenericEvent<C> though.

Comment thread ruma-events-macros/src/event_enum.rs
Comment thread ruma-events-macros/src/event.rs Outdated
Comment thread ruma-events/tests/state_event.rs Outdated
}

#[test]
fn deserialize_member_event_membership_hoist_unsigned_prev_content() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side question (maybe unclear to me bc. English is not my first language): What does 'hoist' mean here?

@DevinR528 DevinR528 Jun 19, 2020

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of membership being in the content field it's at the top-level, "lifted" out.

Would deserialize_member_event_with_top_level_membership_field be better since the prev_content part isn't actually important to why it was failing?

Clean up imports and test names for state_event
@jplatte jplatte merged commit 184aafa into ruma:master Jun 19, 2020
@DevinR528 DevinR528 deleted the revert-content branch May 3, 2021 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants