Merge branch 'room-is-space'

This commit is contained in:
Damir Jelić
2021-10-27 11:08:33 +02:00

View File

@@ -26,8 +26,11 @@ use ruma::{
events::{
receipt::Receipt,
room::{
create::CreateEventContent, encryption::EncryptionEventContent,
guest_access::GuestAccess, history_visibility::HistoryVisibility, join_rules::JoinRule,
create::{CreateEventContent, RoomType as CreateRoomType},
encryption::EncryptionEventContent,
guest_access::GuestAccess,
history_visibility::HistoryVisibility,
join_rules::JoinRule,
tombstone::TombstoneEventContent,
},
tag::Tags,
@@ -130,6 +133,14 @@ impl Room {
self.inner.read().unwrap().room_type
}
/// Whether this room's [`RoomType`](CreateRoomType) is `m.space`.
pub fn is_space(&self) -> bool {
match self.inner.read().unwrap().base_info.create.as_ref() {
Some(create) => create.room_type == Some(CreateRoomType::Space),
None => false,
}
}
/// Get the unread notification counts.
pub fn unread_notification_counts(&self) -> UnreadNotificationsCount {
self.inner.read().unwrap().notification_counts