Skip to content

Commit

Permalink
Ignore ctrl_chars tests, use matrix-org/matrix-rust-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
DevinR528 committed Jun 27, 2020
1 parent 944a5bc commit 3ec22a8
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]`
Expand Down
20 changes: 16 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rumatui"
version = "0.1.16"
version = "0.1.17"
authors = ["Devin R <[email protected]>"]
license = "MIT/Apache-2.0"
description = "A click-able command-line Matrix client."
Expand All @@ -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"
Expand Down
16 changes: 5 additions & 11 deletions src/client/event_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -323,18 +317,18 @@ 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) {
if let SyncRoom::Joined(room) = room {
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::<Vec<String>>();
let room_id = room.read().await.room_id.clone();
let notice = if typing.is_empty() {
Expand Down
7 changes: 4 additions & 3 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -289,7 +290,7 @@ impl MatrixClient {
}

self.inner
.get_public_rooms_filtered(request)
.public_rooms_filtered(request)
.await
.map_err(Into::into)
}
Expand Down
12 changes: 6 additions & 6 deletions src/widgets/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down Expand Up @@ -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())
};

Expand Down
1 change: 1 addition & 0 deletions src/widgets/message/ctrl_char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ fn main() {
}

#[test]
#[ignore]
fn reply_formatter() {
let input = "> In reply to blah blah
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/message/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down

0 comments on commit 3ec22a8

Please sign in to comment.