remove split on UserId, update tests to correct domain

master
Devin R 2020-03-31 15:18:27 -04:00
parent df58c60d2e
commit c3f4a946cb
4 changed files with 6 additions and 13 deletions

View File

@ -73,13 +73,7 @@ pub struct CurrentRoom {
impl CurrentRoom {
// TODO when UserId is isomorphic to &str clean this up.
pub(crate) fn comes_after(&self, user: &Uid, event: &PresenceEvent) -> bool {
let u = user.to_string();
let u = u.split(':').next();
let s = event.sender.to_string();
let s = s.split(':').next();
if u == s {
if user == &event.sender {
if self.last_active.is_none() {
true
} else {
@ -217,7 +211,6 @@ impl Client {
}
pub(crate) fn get_room(&mut self, room_id: &str) -> Option<&mut Arc<RwLock<Room>>> {
#[allow(clippy::or_fun_call)]
self.joined_rooms.get_mut(room_id)
}

View File

@ -319,7 +319,7 @@ mod test {
let session = Session {
access_token: "1234".to_owned(),
user_id: UserId::try_from("@example:example.com").unwrap(),
user_id: UserId::try_from("@example:localhost").unwrap(),
device_id: "DEVICEID".to_owned(),
};

View File

@ -152,7 +152,7 @@ mod test {
let session = Session {
access_token: "1234".to_owned(),
user_id: UserId::try_from("@example:example.com").unwrap(),
user_id: UserId::try_from("@example:localhost").unwrap(),
device_id: "DEVICEID".to_owned(),
};

View File

@ -35,7 +35,7 @@ async fn sync() {
let session = Session {
access_token: "1234".to_owned(),
user_id: UserId::try_from("@example:example.com").unwrap(),
user_id: UserId::try_from("@example:localhost").unwrap(),
device_id: "DEVICEID".to_owned(),
};
@ -64,7 +64,7 @@ async fn room_names() {
let session = Session {
access_token: "1234".to_owned(),
user_id: UserId::try_from("@example:example.com").unwrap(),
user_id: UserId::try_from("@example:localhost").unwrap(),
device_id: "DEVICEID".to_owned(),
};
@ -95,7 +95,7 @@ async fn current_room() {
let session = Session {
access_token: "1234".to_owned(),
user_id: UserId::try_from("@example:example.com").unwrap(),
user_id: UserId::try_from("@example:localhost").unwrap(),
device_id: "DEVICEID".to_owned(),
};