matrix-sdk: Re-enable joins by id or alias.

master
Damir Jelić 2020-05-15 12:32:36 +02:00
parent 458923d313
commit e51e89d9d5
6 changed files with 76 additions and 76 deletions

View File

@ -19,9 +19,9 @@ sqlite-cryptostore = ["matrix-sdk-base/sqlite-cryptostore"]
[dependencies] [dependencies]
http = "0.2.1" http = "0.2.1"
reqwest = "0.10.4" reqwest = "0.10.4"
serde_json = "1.0.52" serde_json = "1.0.53"
thiserror = "1.0.16" thiserror = "1.0.17"
tracing = "0.1.13" tracing = "0.1.14"
url = "2.1.1" url = "2.1.1"
futures-timer = "3.0.2" futures-timer = "3.0.2"
@ -39,14 +39,14 @@ default-features = false
features = ["std", "std-future"] features = ["std", "std-future"]
[dev-dependencies] [dev-dependencies]
async-trait = "0.1.30" async-trait = "0.1.31"
dirs = "2.0.2" dirs = "2.0.2"
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" } matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
ruma-identifiers = { version = "0.16.1", features = ["rand"] } ruma-identifiers = { version = "0.16.1", features = ["rand"] }
serde_json = "1.0.52" serde_json = "1.0.53"
tracing-subscriber = "0.2.5" tracing-subscriber = "0.2.5"
tempfile = "3.1.0" tempfile = "3.1.0"
mockito = "0.25.1" mockito = "0.25.1"
lazy_static = "1.4.0" lazy_static = "1.4.0"
futures = "0.3.4" futures = "0.3.5"

View File

@ -37,7 +37,7 @@ use url::Url;
use crate::events::room::message::MessageEventContent; use crate::events::room::message::MessageEventContent;
use crate::events::EventType; use crate::events::EventType;
use crate::identifiers::{EventId, RoomId, UserId}; use crate::identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId};
use crate::Endpoint; use crate::Endpoint;
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
@ -224,7 +224,7 @@ use api::r0::keys::{claim_keys, get_keys, upload_keys, KeyAlgorithm};
use api::r0::membership::{ use api::r0::membership::{
ban_user, forget_room, ban_user, forget_room,
invite_user::{self, InvitationRecipient}, invite_user::{self, InvitationRecipient},
join_room_by_id, kick_user, leave_room, Invite3pid, join_room_by_id, join_room_by_id_or_alias, kick_user, leave_room, Invite3pid,
}; };
use api::r0::message::create_message_event; use api::r0::message::create_message_event;
use api::r0::message::get_message_events; use api::r0::message::get_message_events;
@ -473,27 +473,27 @@ impl Client {
// TODO enable this once Ruma supports proper serialization of the query // TODO enable this once Ruma supports proper serialization of the query
// string. // string.
///// Join a room by `RoomId`. /// Join a room by `RoomId`.
///// ///
///// Returns a `join_room_by_id_or_alias::Response` consisting of the /// Returns a `join_room_by_id_or_alias::Response` consisting of the
///// joined rooms `RoomId`. /// joined rooms `RoomId`.
///// ///
///// # Arguments /// # Arguments
///// ///
///// * `alias` - The `RoomId` or `RoomAliasId` of the room to be joined. /// * `alias` - The `RoomId` or `RoomAliasId` of the room to be joined.
///// An alias looks like this `#name:example.com` /// An alias looks like this `#name:example.com`
//pub async fn join_room_by_id_or_alias( pub async fn join_room_by_id_or_alias(
// &self, &self,
// alias: &RoomIdOrAliasId, alias: &RoomIdOrAliasId,
// server_names: &[String], server_names: &[String],
//) -> Result<join_room_by_id_or_alias::Response> { ) -> Result<join_room_by_id_or_alias::Response> {
// let request = join_room_by_id_or_alias::Request { let request = join_room_by_id_or_alias::Request {
// room_id_or_alias: alias.clone(), room_id_or_alias: alias.clone(),
// server_name: server_names.to_owned(), server_name: server_names.to_owned(),
// third_party_signed: None, third_party_signed: None,
// }; };
// self.send(request).await self.send(request).await
//} }
/// Forget a room by `RoomId`. /// Forget a room by `RoomId`.
/// ///
@ -1240,7 +1240,7 @@ mod test {
use crate::events::collections::all::RoomEvent; use crate::events::collections::all::RoomEvent;
use crate::events::room::member::MembershipState; use crate::events::room::member::MembershipState;
use crate::events::room::message::TextMessageEventContent; use crate::events::room::message::TextMessageEventContent;
use crate::identifiers::{EventId, RoomId, UserId}; use crate::identifiers::{EventId, RoomId, RoomIdOrAliasId, UserId};
use matrix_sdk_base::JsonStore; use matrix_sdk_base::JsonStore;
use matrix_sdk_test::{EventBuilder, EventsFile}; use matrix_sdk_test::{EventBuilder, EventsFile};
@ -1380,37 +1380,37 @@ mod test {
// TODO enable this once Ruma supports proper serialization of the query // TODO enable this once Ruma supports proper serialization of the query
// string. // string.
// #[tokio::test] #[tokio::test]
// async fn join_room_by_id_or_alias() { async fn join_room_by_id_or_alias() {
// let homeserver = Url::from_str(&mockito::server_url()).unwrap(); let homeserver = Url::from_str(&mockito::server_url()).unwrap();
// let session = Session { let session = Session {
// access_token: "1234".to_owned(), access_token: "1234".to_owned(),
// user_id: UserId::try_from("@example:localhost").unwrap(), user_id: UserId::try_from("@example:localhost").unwrap(),
// device_id: "DEVICEID".to_owned(), device_id: "DEVICEID".to_owned(),
// }; };
// let _m = mock( let _m = mock(
// "POST", "POST",
// Matcher::Regex(r"^/_matrix/client/r0/join/".to_string()), Matcher::Regex(r"^/_matrix/client/r0/join/".to_string()),
// ) )
// .with_status(200) .with_status(200)
// .with_body_from_file("../test_data/room_id.json") .with_body_from_file("../test_data/room_id.json")
// .create(); .create();
// let client = Client::new(homeserver, Some(session)).unwrap(); let client = Client::new(homeserver, Some(session)).unwrap();
// let room_id = RoomIdOrAliasId::try_from("!testroom:example.org").unwrap(); let room_id = RoomIdOrAliasId::try_from("!testroom:example.org").unwrap();
// assert_eq!( assert_eq!(
// // this is the `join_by_room_id::Response` but since no PartialEq we check the RoomId field // this is the `join_by_room_id::Response` but since no PartialEq we check the RoomId field
// client client
// .join_room_by_id_or_alias(&room_id, &["server.com".to_string()]) .join_room_by_id_or_alias(&room_id, &["server.com".to_string()])
// .await .await
// .unwrap() .unwrap()
// .room_id, .room_id,
// RoomId::try_from("!testroom:example.org").unwrap() RoomId::try_from("!testroom:example.org").unwrap()
// ); );
// } }
#[tokio::test] #[tokio::test]
#[allow(irrefutable_let_patterns)] #[allow(irrefutable_let_patterns)]

View File

@ -17,18 +17,18 @@ encryption = ["matrix-sdk-crypto"]
sqlite-cryptostore = ["matrix-sdk-crypto/sqlite-cryptostore"] sqlite-cryptostore = ["matrix-sdk-crypto/sqlite-cryptostore"]
[dependencies] [dependencies]
async-trait = "0.1.30" async-trait = "0.1.31"
serde = "1.0.106" serde = "1.0.110"
serde_json = "1.0.52" serde_json = "1.0.53"
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }
matrix-sdk-crypto = { version = "0.1.0", path = "../matrix_sdk_crypto", optional = true } matrix-sdk-crypto = { version = "0.1.0", path = "../matrix_sdk_crypto", optional = true }
# Misc dependencies # Misc dependencies
thiserror = "1.0.16" thiserror = "1.0.17"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
version = "0.2.20" version = "0.2.21"
default-features = false default-features = false
features = ["sync", "fs"] features = ["sync", "fs"]
@ -40,7 +40,7 @@ tracing-subscriber = "0.2.5"
tempfile = "3.1.0" tempfile = "3.1.0"
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
[target.'cfg(target_arch = "wasm32")'.dev-dependencies] [target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.12" wasm-bindgen-test = "0.3.12"

View File

@ -12,7 +12,7 @@ version = "0.1.0"
[dependencies] [dependencies]
js_int = "0.1.5" js_int = "0.1.5"
ruma-api = "0.16.0" ruma-api = "0.16.1"
ruma-client-api = "0.8.0" ruma-client-api = "0.8.0"
ruma-events = "0.21.1" ruma-events = "0.21.1"
ruma-identifiers = "0.16.1" ruma-identifiers = "0.16.1"
@ -22,7 +22,7 @@ instant = { version = "0.1.3", features = ["wasm-bindgen", "now"] }
uuid = { version = "0.8.1", features = ["v4"] } uuid = { version = "0.8.1", features = ["v4"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.tokio]
version = "0.2.20" version = "0.2.21"
default-features = false default-features = false
features = ["sync", "time", "fs"] features = ["sync", "time", "fs"]

View File

@ -15,20 +15,20 @@ default = []
sqlite-cryptostore = ["sqlx"] sqlite-cryptostore = ["sqlx"]
[dependencies] [dependencies]
async-trait = "0.1.30" async-trait = "0.1.31"
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }
olm-rs = { version = "0.5.0", features = ["serde"] } olm-rs = { version = "0.5.0", features = ["serde"] }
serde = { version = "1.0.106", features = ["derive"] } serde = { version = "1.0.110", features = ["derive"] }
serde_json = "1.0.52" serde_json = "1.0.53"
cjson = "0.1.0" cjson = "0.1.0"
zeroize = { version = "1.1.0", features = ["zeroize_derive"] } zeroize = { version = "1.1.0", features = ["zeroize_derive"] }
url = "2.1.1" url = "2.1.1"
# Misc dependencies # Misc dependencies
thiserror = "1.0.16" thiserror = "1.0.17"
tracing = "0.1.13" tracing = "0.1.14"
atomic = "0.4.5" atomic = "0.4.5"
dashmap = "3.11.1" dashmap = "3.11.1"
@ -44,8 +44,8 @@ default-features = false
features = ["runtime-tokio", "sqlite"] features = ["runtime-tokio", "sqlite"]
[dev-dependencies] [dev-dependencies]
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] } tokio = { version = "0.2.21", features = ["rt-threaded", "macros"] }
ruma-identifiers = { version = "0.16.1", features = ["rand"] } ruma-identifiers = { version = "0.16.1", features = ["rand"] }
serde_json = "1.0.52" serde_json = "1.0.53"
tempfile = "3.1.0" tempfile = "3.1.0"
http = "0.2.1" http = "0.2.1"

View File

@ -11,7 +11,7 @@ repository = "https://github.com/matrix-org/matrix-rust-sdk"
version = "0.1.0" version = "0.1.0"
[dependencies] [dependencies]
serde_json = "1.0.52" serde_json = "1.0.53"
http = "0.2.1" http = "0.2.1"
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }
matrix-sdk-test-macros = { path = "../matrix_sdk_test_macros" } matrix-sdk-test-macros = { path = "../matrix_sdk_test_macros" }