refactor(base): Add RoomInfo::new constructor

This commit is contained in:
Jonas Platte
2022-06-29 14:31:24 +02:00
committed by Jonas Platte
parent 4187aa400f
commit a43005dec2

View File

@@ -103,16 +103,7 @@ impl Room {
room_id: &RoomId,
room_type: RoomType,
) -> Self {
let room_info = RoomInfo {
room_id: room_id.into(),
room_type,
notification_counts: Default::default(),
summary: Default::default(),
members_synced: false,
last_prev_batch: None,
base_info: BaseRoomInfo::new(),
};
let room_info = RoomInfo::new(room_id, room_type);
Self::restore(own_user_id, store, room_info)
}
@@ -655,6 +646,18 @@ pub struct RoomInfo {
}
impl RoomInfo {
pub(crate) fn new(room_id: &RoomId, room_type: RoomType) -> Self {
Self {
room_id: room_id.into(),
room_type,
notification_counts: Default::default(),
summary: Default::default(),
members_synced: false,
last_prev_batch: None,
base_info: BaseRoomInfo::new(),
}
}
/// Mark this Room as joined
pub fn mark_as_joined(&mut self) {
self.room_type = RoomType::Joined;