From 3ec22a88e7746c365612744c7e16e0f14f086dd5 Mon Sep 17 00:00:00 2001 From: Devin R Date: Sat, 27 Jun 2020 08:38:44 -0400 Subject: [PATCH] Ignore ctrl_chars tests, use matrix-org/matrix-rust-sdk --- CHANGELOG.md | 5 +++++ Cargo.lock | 20 ++++++++++++++++---- Cargo.toml | 4 ++-- src/client/event_stream.rs | 16 +++++----------- src/client/mod.rs | 7 ++++--- src/widgets/app.rs | 12 ++++++------ src/widgets/message/ctrl_char.rs | 1 + src/widgets/message/msgs.rs | 4 ++-- 8 files changed, 41 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ac4a1e..045e715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# [0.1.17] + +* Ignore all `widgets::ctrl_chars` tests for Nix packaging +* Use matrix-org/master for matrix-rust-sdk + # [0.1.16] * Add help output `rumatui [-h/--help]` diff --git a/Cargo.lock b/Cargo.lock index 0382ef1..effd211 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1164,12 +1164,13 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "matrix-sdk" version = "0.1.0" -source = "git+https://github.com/DevinR528/matrix-rust-sdk?branch=rumatui#7a46cc213aabf1fb3bffec270dbd647168a75ff7" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#cd9252cc3d9d46770db54a1c6317aa4a52b52cf3" dependencies = [ "futures-timer", "http", "matrix-sdk-base", "matrix-sdk-common", + "matrix-sdk-common-macros", "reqwest", "serde_json", "thiserror", @@ -1181,10 +1182,11 @@ dependencies = [ [[package]] name = "matrix-sdk-base" version = "0.1.0" -source = "git+https://github.com/DevinR528/matrix-rust-sdk?branch=rumatui#7a46cc213aabf1fb3bffec270dbd647168a75ff7" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#cd9252cc3d9d46770db54a1c6317aa4a52b52cf3" dependencies = [ "async-trait", "matrix-sdk-common", + "matrix-sdk-common-macros", "matrix-sdk-crypto", "serde", "serde_json", @@ -1196,7 +1198,7 @@ dependencies = [ [[package]] name = "matrix-sdk-common" version = "0.1.0" -source = "git+https://github.com/DevinR528/matrix-rust-sdk?branch=rumatui#7a46cc213aabf1fb3bffec270dbd647168a75ff7" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#cd9252cc3d9d46770db54a1c6317aa4a52b52cf3" dependencies = [ "futures-locks", "instant", @@ -1209,16 +1211,26 @@ dependencies = [ "uuid", ] +[[package]] +name = "matrix-sdk-common-macros" +version = "0.1.0" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#cd9252cc3d9d46770db54a1c6317aa4a52b52cf3" +dependencies = [ + "quote", + "syn", +] + [[package]] name = "matrix-sdk-crypto" version = "0.1.0" -source = "git+https://github.com/DevinR528/matrix-rust-sdk?branch=rumatui#7a46cc213aabf1fb3bffec270dbd647168a75ff7" +source = "git+https://github.com/matrix-org/matrix-rust-sdk#cd9252cc3d9d46770db54a1c6317aa4a52b52cf3" dependencies = [ "async-trait", "atomic", "cjson", "dashmap", "matrix-sdk-common", + "matrix-sdk-common-macros", "olm-rs", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 62e25ec..99fecd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rumatui" -version = "0.1.16" +version = "0.1.17" authors = ["Devin R "] license = "MIT/Apache-2.0" description = "A click-able command-line Matrix client." @@ -26,7 +26,7 @@ lazy_static = "1.4.0" # matrix-sdk = "0.1.0" # matrix-sdk-base = { version = "0.1.0", features = ["messages"] } -matrix-sdk = { git = "https://github.com/DevinR528/matrix-rust-sdk", branch = "rumatui" } +matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk" } mdcat = "0.18.2" muncher = "0.6.1" diff --git a/src/client/event_stream.rs b/src/client/event_stream.rs index 65d7eb0..f9ac5d2 100644 --- a/src/client/event_stream.rs +++ b/src/client/event_stream.rs @@ -114,13 +114,7 @@ impl EventEmitter for EventStream { /// Send a membership change event to the ui thread. async fn on_room_member(&self, room: SyncRoom, event: &MemberEvent) { match room { - SyncRoom::Invited(room) => { - self.handle_room_member(room, event).await; - } - SyncRoom::Left(room) => { - self.handle_room_member(room, event).await; - } - SyncRoom::Joined(room) => { + SyncRoom::Invited(room) | SyncRoom::Left(room) | SyncRoom::Joined(room) => { self.handle_room_member(room, event).await; } } @@ -160,7 +154,7 @@ impl EventEmitter for EventStream { .. } = event; - let name = if let Some(mem) = room.read().await.members.get(&sender) { + let name = if let Some(mem) = room.read().await.joined_members.get(&sender) { mem.name.clone() } else { sender.localpart().into() @@ -323,7 +317,7 @@ impl EventEmitter for EventStream { } } } - // TODO make the StateResult::Typing variants a list of typing users and make messages in app + // TODO make the StateResult::Typing variants a list of typing users and make the app.rs work // like every other StateResult. Use Room::compute_display_name or whatever when PR is done /// Fires when `AsyncClient` receives a `NonRoomEvent::Typing` event. async fn on_non_room_typing(&self, room: SyncRoom, event: &TypingEvent) { @@ -331,10 +325,10 @@ impl EventEmitter for EventStream { let typing = room .read() .await - .members + .joined_members .iter() .filter(|(id, _)| event.content.user_ids.contains(id)) - .map(|(_, mem)| mem.name.to_string()) + .map(|(_, mem)| mem.name()) .collect::>(); let room_id = room.read().await.room_id.clone(); let notice = if typing.is_empty() { diff --git a/src/client/mod.rs b/src/client/mod.rs index 6600b9d..cd46e1f 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -14,7 +14,8 @@ use matrix_sdk::{ }, events::room::message::MessageEventContent, identifiers::{DeviceId, EventId, RoomId, UserId}, - Client, ClientConfig, JsonStore, RegistrationBuilder, Room, RoomSearchBuilder, SyncSettings, + Client, ClientConfig, JsonStore, RegistrationBuilder, Room, RoomListFilterBuilder, + SyncSettings, }; use tokio::sync::RwLock; use url::Url; @@ -277,7 +278,7 @@ impl MatrixClient { } else { Some(filter.to_string()) }; - let mut request = RoomSearchBuilder::new(); + let mut request = RoomListFilterBuilder::new(); request .filter(Filter { generic_search_term: filter, @@ -289,7 +290,7 @@ impl MatrixClient { } self.inner - .get_public_rooms_filtered(request) + .public_rooms_filtered(request) .await .map_err(Into::into) } diff --git a/src/widgets/app.rs b/src/widgets/app.rs index 7b73b09..b3ffcb8 100644 --- a/src/widgets/app.rs +++ b/src/widgets/app.rs @@ -436,11 +436,11 @@ impl AppWidget { // find the room the message was just sent to let local_message = if let Some(room) = self.chat.rooms().get(&room_id) { let r = room.read().await; - let matrix_sdk::Room { members, .. } = r.deref(); + let matrix_sdk::Room { joined_members, .. } = r.deref(); let name = if let Some(mem) = - members.get(self.chat.as_current_user().unwrap()) + joined_members.get(self.chat.as_current_user().unwrap()) { - mem.name.clone() + mem.name() } else { self.chat.as_current_user().unwrap().localpart().into() }; @@ -821,10 +821,10 @@ impl AppWidget { } = msg; let name = { - let m = room.read().await; - m.members + let room = room.read().await; + room.joined_members .get(&sender) - .map(|m| m.name.to_string()) + .map(|m| m.name()) .unwrap_or(sender.localpart().to_string()) }; diff --git a/src/widgets/message/ctrl_char.rs b/src/widgets/message/ctrl_char.rs index e502354..4eac48e 100644 --- a/src/widgets/message/ctrl_char.rs +++ b/src/widgets/message/ctrl_char.rs @@ -521,6 +521,7 @@ fn main() { } #[test] + #[ignore] fn reply_formatter() { let input = "> In reply to blah blah diff --git a/src/widgets/message/msgs.rs b/src/widgets/message/msgs.rs index 07ec54e..89c2d74 100644 --- a/src/widgets/message/msgs.rs +++ b/src/widgets/message/msgs.rs @@ -120,8 +120,8 @@ impl MessageWidget { unsigned, .. } = event; - let name = if let Some(mem) = room.members.get(&sender) { - mem.name.clone() + let name = if let Some(mem) = room.joined_members.get(&sender) { + mem.name() } else { sender.localpart().into() };