-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept any string as a key for m.direct account data
- Loading branch information
Showing
12 changed files
with
69 additions
and
30 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ use ruma::{ | |
}, | ||
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 +630,37 @@ 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()); | ||
} | ||
|
||
#[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