Skip to content

sdk: share room history when we send an invite #4946

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

Merged
merged 3 commits into from
Apr 23, 2025

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Apr 16, 2025

... subject to an experimental feature flag.

Fixes: #4511

@richvdh richvdh requested a review from a team as a code owner April 16, 2025 15:16
@richvdh richvdh requested review from andybalaam and removed request for a team April 16, 2025 15:16
richvdh added 2 commits April 16, 2025 16:53
... subject to an experimental feature flag.
... otherwise, it fails with an error, which makes the integ tests fail
@richvdh richvdh force-pushed the rav/history_sharing/share_on_invite branch from 31c7a99 to 18f20a7 Compare April 16, 2025 15:54
Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.93%. Comparing base (bc50cae) to head (6e96391).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/room/shared_room_history.rs 77.77% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4946   +/-   ##
=======================================
  Coverage   85.92%   85.93%           
=======================================
  Files         324      324           
  Lines       35614    35619    +5     
=======================================
+ Hits        30603    30610    +7     
+ Misses       5011     5009    -2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 couple of nits and questions.

Comment on lines +1480 to +1484
#[cfg(all(feature = "experimental-share-history-on-invite", feature = "e2e-encryption"))]
{
shared_room_history::share_room_history(self, user_id.to_owned()).await?;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, are we certain that people won't want to have a way to say "Ok, invite this person, but absolutely don't share the room history with them"?

I can see that we might want to do this by default, but I can also see that some people might want to opt out.

This might be a nice place to introduce a named future, which would allow us to:

  1. Make this configurable
  2. Not break the API despite having newly added configuration options.

I don't mean that we should do this right now, but perhaps down the line as we stabilize support for this feature.

Copy link
Member

Choose a reason for hiding this comment

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

When we've discussed this in the past, we have talked about not wanting different people to have different views of a room, especially because if the person with incomplete history then invites another person, they also have incomplete history, and it gets very confusing.

So I think we don't want this option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I guess that weakens my argument towards "the SDK shouldn't be as opinionated as the Element clients".

But ok, I think we can revisit this and discuss later if the SDK should make this optional.

@@ -1480,6 +1477,11 @@ impl Room {
/// * `user_id` - The `UserId` of the user to invite to the room.
#[instrument(skip_all)]
pub async fn invite_user_by_id(&self, user_id: &UserId) -> Result<()> {
#[cfg(all(feature = "experimental-share-history-on-invite", feature = "e2e-encryption"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

There are other ways to invite a user, don't we need to take care of them as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Like what? invite_user_by_3pid? Ideally yes, but this flow isn't going to work there, because we don't have a matrix ID for the target user. We ought to think about it at some point, but I think it's well out of scope for this prototyping effort. I've added a note at element-hq/element-meta#2685 (comment).

Copy link
Member

@andybalaam andybalaam 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 to me!

@richvdh richvdh merged commit 75cde02 into main Apr 23, 2025
43 checks passed
@richvdh richvdh deleted the rav/history_sharing/share_on_invite branch April 23, 2025 10:15
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.

Encrypted history sharing: hook up share & upload to sending room invites
3 participants