-
Notifications
You must be signed in to change notification settings - Fork 358
feat(widget): Receive custom to-device messages in widgets in e2ee rooms #5116
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
feat(widget): Receive custom to-device messages in widgets in e2ee rooms #5116
Conversation
877b583 to
41e0af9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5116 +/- ##
==========================================
+ Coverage 85.10% 85.24% +0.14%
==========================================
Files 329 329
Lines 36940 37032 +92
==========================================
+ Hits 31437 31569 +132
+ Misses 5503 5463 -40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
poljar
left a comment
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.
This looks mostly good. I left some smaller nits, after that I think we can merge.
| // Some to-device traffic is used by the sdk for internal machinery. | ||
| // They should not be exposed to widgets. | ||
| if Self::should_filter_message_to_widget(&raw) { | ||
| trace!("Internal or UTD to-device message filtered out by widget driver."); |
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.
You are not attaching any data to this log line, it will be hard to know what got filtered out. Consider moving this into the should_filter_message_...() method so we can at least log the event type.
| /// - A `MockGuard` the end-point mock is scoped to this guard | ||
| /// - A `Future` that resolves to a `Value` containing the captured | ||
| /// encrypted to-device message. | ||
| pub async fn mock_capture_put_to_device( |
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.
That's a neat function, could we add an example to the doc so:
- The functions i kind off tested as a doctest
- Other people will more easily discover how to use it
and refactor test utility to return Raw<EncrytpedToDeviceEvent> instead of Value
poljar
left a comment
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.
This looks good, left still one nit.
If the nit doesn't make sense let me know and we can merge after that.
|
|
||
| if filtered { | ||
| trace!( | ||
| "To-device message of type <{}> filtered out by widget driver.", |
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.
This works as well, right?
| "To-device message of type <{}> filtered out by widget driver.", | |
| "To-device message of type <{event_type}> filtered out by widget driver.", |
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.
yes that works, missed it
Proper support for receiving to-device messages for widgets
If the widget is in an e2ee room, clear to-device traffic will be excluded.
Also filter out internal to-device messages that widgets should not be aware off
Draft for now because depends on
add_event_handler#5099EncryptionInfotoDecryptedto-device variant #5074I want to add more test, but for that I'd like to have this PR for new common mock helpers to be merged.
Signed-off-by: