-
Notifications
You must be signed in to change notification settings - Fork 254
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
Accept any string as a key for m.direct
account data
#4228
Open
MatMaul
wants to merge
1
commit into
matrix-org:main
Choose a base branch
from
tchapgouv:fix-dm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+154
−88
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,14 @@ use ruma::{ | |
api::client::{membership::Invite3pidInit, receipt::create_receipt::v3::ReceiptType}, | ||
assign, event_id, | ||
events::{ | ||
direct::DirectUserIdentifier, | ||
receipt::ReceiptThread, | ||
room::message::{RoomMessageEventContent, RoomMessageEventContentWithoutRelation}, | ||
TimelineEventType, | ||
}, | ||
int, mxc_uri, owned_event_id, room_id, thirdparty, user_id, OwnedUserId, TransactionId, | ||
}; | ||
use serde_json::{json, Value}; | ||
use serde_json::{from_value, json, Value}; | ||
use wiremock::{ | ||
matchers::{body_json, body_partial_json, header, method, path_regex}, | ||
Mock, ResponseTemplate, | ||
|
@@ -630,6 +631,38 @@ async fn test_reset_power_levels() { | |
room.reset_power_levels().await.unwrap(); | ||
} | ||
|
||
#[async_test] | ||
async fn test_is_direct_invite_by_3pid() { | ||
let (client, server) = logged_in_client_with_server().await; | ||
|
||
let mut sync_builder = SyncResponseBuilder::new(); | ||
sync_builder.add_joined_room(JoinedRoomBuilder::default()); | ||
let data = json!({ | ||
"content": { | ||
"[email protected]": [*DEFAULT_TEST_ROOM_ID], | ||
}, | ||
"event_id": "$757957878228ekrDs:localhost", | ||
"origin_server_ts": 17195787, | ||
"sender": "@example:localhost", | ||
"state_key": "", | ||
"type": "m.direct", | ||
"unsigned": { | ||
"age": 139298 | ||
} | ||
}); | ||
sync_builder.add_global_account_data_bulk(vec![from_value(data).unwrap()]); | ||
|
||
mock_sync(&server, sync_builder.build_json_sync_response(), None).await; | ||
mock_encryption_state(&server, false).await; | ||
|
||
let sync_settings = SyncSettings::new().timeout(Duration::from_millis(3000)); | ||
let _response = client.sync_once(sync_settings).await.unwrap(); | ||
|
||
let room = client.get_room(&DEFAULT_TEST_ROOM_ID).unwrap(); | ||
assert!(room.is_direct().await.unwrap()); | ||
assert!(room.direct_targets().contains(<&DirectUserIdentifier>::from("[email protected]"))); | ||
} | ||
|
||
#[async_test] | ||
async fn test_call_notifications_ring_for_dms() { | ||
let (client, server) = logged_in_client_with_server().await; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Potentially stating the obvious here, but if you wanna do a crates.io release soon (I think this was planned), make sure to only merge this PR afterwards 😉
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.
New policy in town, no git deps anymore. That's why cargo-deny makes the CI fail.
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.
Oh. Well I don't think we'll have the Ruma change blocking this PR out on crates.io anytime soon.
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.
No rush on my side, it can wait.
Feel free to review in the meantime, so we can merge when we got a ruma release out.