remove split on UserId, update tests to correct domain
parent
df58c60d2e
commit
c3f4a946cb
|
@ -73,13 +73,7 @@ pub struct CurrentRoom {
|
||||||
impl CurrentRoom {
|
impl CurrentRoom {
|
||||||
// TODO when UserId is isomorphic to &str clean this up.
|
// TODO when UserId is isomorphic to &str clean this up.
|
||||||
pub(crate) fn comes_after(&self, user: &Uid, event: &PresenceEvent) -> bool {
|
pub(crate) fn comes_after(&self, user: &Uid, event: &PresenceEvent) -> bool {
|
||||||
let u = user.to_string();
|
if user == &event.sender {
|
||||||
let u = u.split(':').next();
|
|
||||||
|
|
||||||
let s = event.sender.to_string();
|
|
||||||
let s = s.split(':').next();
|
|
||||||
|
|
||||||
if u == s {
|
|
||||||
if self.last_active.is_none() {
|
if self.last_active.is_none() {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
|
@ -217,7 +211,6 @@ impl Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_room(&mut self, room_id: &str) -> Option<&mut Arc<RwLock<Room>>> {
|
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)
|
self.joined_rooms.get_mut(room_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ mod test {
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
access_token: "1234".to_owned(),
|
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(),
|
device_id: "DEVICEID".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ mod test {
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
access_token: "1234".to_owned(),
|
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(),
|
device_id: "DEVICEID".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ async fn sync() {
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
access_token: "1234".to_owned(),
|
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(),
|
device_id: "DEVICEID".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ async fn room_names() {
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
access_token: "1234".to_owned(),
|
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(),
|
device_id: "DEVICEID".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ async fn current_room() {
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
access_token: "1234".to_owned(),
|
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(),
|
device_id: "DEVICEID".to_owned(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue