Add topic to the UI store Room

This commit is contained in:
2024-06-27 08:25:11 +02:00
parent 73c5b70ba8
commit d5d996eec3
3 changed files with 15 additions and 6 deletions

View File

@@ -12,13 +12,15 @@ use crate::domain::model::{
store_interface::{RoomStoreConsumerInterface, RoomStoreProviderInterface},
};
#[modx::props(id, is_direct, name, spaces)]
#[modx::props(id, is_direct, name, topic, spaces)]
#[modx::store]
pub struct Store {
id: RoomId,
is_direct: Option<bool>,
name: Option<String>,
topic: Option<String>,
avatar: Option<Avatar>,
members: Vec<RoomMember>,
invitations: Vec<Invitation>,
@@ -45,6 +47,7 @@ impl Room {
room.id().clone(),
room.is_direct(),
room.name(),
room.topic(),
room.spaces().clone(),
);
@@ -71,6 +74,11 @@ impl RoomStoreProviderInterface for Room {
store.avatar.set(avatar);
}
fn on_new_topic(&self, topic: Option<String>) {
let mut store = self.store.borrow_mut();
store.topic.set(topic);
}
fn on_new_member(&self, member: RoomMember) {
let mut store = self.store.borrow_mut();
store.members.write().push(member);