-
Notifications
You must be signed in to change notification settings - Fork 258
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
14 changed files
with
154 additions
and
88 deletions.
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