-
Notifications
You must be signed in to change notification settings - Fork 269
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(timeline): handle more timeline item content kinds in replied-to details #4649
Conversation
e95e74c
to
af30b47
Compare
Note for reviewers: don't be afraid by the number of LOC, there are many repetitive tests in there. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4649 +/- ##
=======================================
Coverage 85.68% 85.68%
=======================================
Files 292 292
Lines 33570 33597 +27
=======================================
+ Hits 28763 28788 +25
- Misses 4807 4809 +2 ☔ View full report in Codecov by Sentry. |
let utd_info = as_variant!( | ||
&timeline_event.kind, | ||
TimelineEventKind::UnableToDecrypt { utd_info, .. } => utd_info | ||
); | ||
|
||
let utd_cause = if let Some(utd_info) = utd_info { | ||
UtdCause::determine( | ||
timeline_event.raw(), | ||
room_data_provider.crypto_context_info().await, | ||
&utd_info, | ||
) | ||
} else { | ||
UtdCause::Unknown | ||
}; |
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.
Seems simpler to use a single match
for this, no?
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.
Good idea!
let content = match event.original_content() { | ||
Some(content) => match content { | ||
AnyMessageLikeEventContent::RoomMessage(c) => { | ||
// Assume we're not interested in reactions in this context. |
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.
It might make sense to explain why we're not interested.
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.
Good point, edited with this comment:
// Assume we're not interested in reactions in this context: this is
// information for an embedded (replied-to) event, that will usually not
// include detailed information like reactions.
) => { | ||
// Assume we're not interested in reactions in this context. | ||
let reactions = ReactionsByKeyBySender::default(); | ||
// TODO could we provide the bundled edit here? |
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.
// TODO could we provide the bundled edit here? | |
// TODO: could we provide the bundled edit here? |
fdde8f1
to
335d884
Compare
Right now, the replied-to details can only contain information about a room message, while we can have other timeline item contents for an item. In particular, the replied-to event could be still encrypted (UTD), and that shouldn't be considered an "unsupported kind", as in element-hq/element-x-ios#3774. Instead, consumers can display the replied-to event was a UTD, and perform manual retries in the background later on (after a backup key has been downloaded, for instance).
Remaining tasks:
[ ] Since the code getting aTimelineItemContent
from a Ruma event is so similar to the code used when handling an event, I'm planning to attempt to merge the two.