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

notification client: use the membership state to match an invite #4000

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Sep 16, 2024

The notification client was relying on the SS proxy including the event_id of a stripped room membership event, to correctly match an invite. This is not the case anymore with SSS (in the spec, stripped events don't include an event_id, although I don't see any good reason why), so we have to resort to a different mechanism:

  • stash an invite event for the current user, if found.
  • use it, if and only if, the room was inferred by the notification client to be in the invited state, based on the sync.

With this change, matrix-sdk-integration-testing tests::sliding_sync::notification_client::test_notification integration test from #3983 passes correctly.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 37.50000% with 20 lines in your changes missing coverage. Please review.

Project coverage is 84.23%. Comparing base (aa92e26) to head (59553d6).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk-ui/src/notification_client.rs 37.50% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4000      +/-   ##
==========================================
- Coverage   84.27%   84.23%   -0.05%     
==========================================
  Files         266      266              
  Lines       28315    28328      +13     
==========================================
- Hits        23863    23862       -1     
- Misses       4452     4466      +14     

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

@bnjbvr bnjbvr force-pushed the bnjbvr/use-membership-state-in-notification-client branch from 67b10a0 to 59553d6 Compare September 16, 2024 11:28
@bnjbvr bnjbvr marked this pull request as ready for review September 16, 2024 11:29
@bnjbvr bnjbvr requested a review from a team as a code owner September 16, 2024 11:29
@bnjbvr bnjbvr requested review from stefanceriu and removed request for a team September 16, 2024 11:29
crates/matrix-sdk-ui/src/notification_client.rs Outdated Show resolved Hide resolved

// Try to match the event by membership and state_key for the current user.
if deserialized.content.membership == MembershipState::Invite
&& deserialized.state_key == user_id
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure it's gonna work with the latest version of Ruma. Either you transform user_id into the type of state_key, or you extract the user ID from state_key with state_key.user_id().

Copy link
Member Author

Choose a reason for hiding this comment

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

This is rebased on main, so should be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

(It's not a call room member event, but a general room member event.)

Copy link
Member

Choose a reason for hiding this comment

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

Alright.

@bnjbvr bnjbvr requested a review from Hywan September 16, 2024 11:31
@bnjbvr bnjbvr enabled auto-merge (rebase) September 16, 2024 11:48
@bnjbvr bnjbvr merged commit 965390c into main Sep 16, 2024
47 of 63 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/use-membership-state-in-notification-client branch September 16, 2024 12:02
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