✨ Add topic to the UI store Room
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user