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(sliding_sync): Add ignore_verification_requests method to SlidingSyncBuilder #4705

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions crates/matrix-sdk-base/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ impl BaseClient {
limited: bool,
events: Vec<Raw<AnySyncTimelineEvent>>,
ignore_state_events: bool,
#[cfg(feature = "e2e-encryption")] ignore_verification_requests: bool,
#[cfg(not(feature = "e2e-encryption"))] _ignore_verification_requests: bool,
prev_batch: Option<String>,
push_rules: &Ruleset,
user_ids: &mut BTreeSet<OwnedUserId>,
Expand Down Expand Up @@ -496,13 +498,18 @@ impl BaseClient {
SyncMessageLikeEvent::Original(original_event),
) => match &original_event.content.msgtype {
MessageType::VerificationRequest(_) => {
Box::pin(self.handle_verification_event(e, room.room_id()))
.await?;
if !ignore_verification_requests {
Box::pin(self.handle_verification_event(e, room.room_id()))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we use this ignore_verification_requests inside the handle_verification_event method instead of here?

.await?;
}
Comment on lines +501 to +504
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we ignore all verification events? I guess the crypto crate already does so if it doesn't receive an m.key.verification.request event, but I think it'll log a bunch of warnings in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that what I'm doing below? I'm not sure I fully understand the underlying logic, but I think this branch takes the verification requests and the one below any other verification event.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, how did I miss that one. You are indeed right.

Can we then rename the flag and setting? Since we indeed don't just ignore the requests ignore_verification_events might make more sense.

}
_ => (),
},
_ if e.event_type().to_string().starts_with("m.key.verification") => {
Box::pin(self.handle_verification_event(e, room.room_id())).await?;
if !ignore_verification_requests {
Box::pin(self.handle_verification_event(e, room.room_id()))
.await?;
}
}
_ => (),
},
Expand Down Expand Up @@ -1039,6 +1046,7 @@ impl BaseClient {
new_info.timeline.limited,
new_info.timeline.events,
false,
false,
new_info.timeline.prev_batch,
&push_rules,
&mut user_ids,
Expand Down Expand Up @@ -1134,6 +1142,7 @@ impl BaseClient {
new_info.timeline.limited,
new_info.timeline.events,
false,
false,
new_info.timeline.prev_batch,
&push_rules,
&mut user_ids,
Expand Down
Loading
Loading