Skip to content
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

fix(sdk): when an encryption event is received, mark the room encryption as set #3602

Merged

Conversation

jmartinesp
Copy link
Contributor

RoomInfo::handle_state_event(...) will check this condition so we don't have to later ask the HS whether the room is encrypted or not through room::is_encrypted().

Also, as we need some way to get this info in the room list in our clients, I also added 2 ways of doing this the FFI crate, one through RoomInfo and another one through RoomListItem. If we don't want the duplication I can get rid of one of them.

This bug was found by @poljar, thanks for pointing it out!

  • Public API changes documented in changelogs (optional)

Signed-off-by:

… encryption as set.

`RoomInfo::handle_state_event` will check this condition so we don't have to later ask the HS whether the room is encrypted or not through `room::is_encrypted()`.
@jmartinesp jmartinesp requested a review from a team as a code owner June 24, 2024 14:05
@jmartinesp jmartinesp requested review from Hywan and removed request for a team June 24, 2024 14:05
Copy link

codecov bot commented Jun 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.88%. Comparing base (74b770f) to head (0162f6b).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3602      +/-   ##
==========================================
- Coverage   83.88%   83.88%   -0.01%     
==========================================
  Files         254      254              
  Lines       26306    26309       +3     
==========================================
  Hits        22068    22068              
- Misses       4238     4241       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Looks good, left a nit about the documentation.

@@ -566,6 +566,10 @@ impl RoomListItem {
self.inner.init_timeline_with_builder(timeline_builder).map_err(RoomListError::from).await
}

async fn is_encrypted(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a doc comment, documentation is nowadays visible over the FFI, also please document that the correctness of this might depend on specifying m.room.encryption as required state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if 0162f6b works for you.

@jmartinesp jmartinesp requested a review from poljar June 25, 2024 10:45
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Thanks, looks good.

@poljar poljar merged commit 0ab0678 into main Jun 25, 2024
38 checks passed
@poljar poljar deleted the fix/encryption-events-should-mark-encryption-state-as-set branch June 25, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants