Add the capability to join a conversation

This commit is contained in:
2024-09-08 16:07:13 +02:00
parent 648be8ba72
commit 9d95bd4481
8 changed files with 76 additions and 21 deletions

View File

@@ -44,6 +44,7 @@ pub trait RoomMessagingConsumerInterface {
#[async_trait(?Send)]
pub trait RoomMessagingProviderInterface {
async fn get_avatar(&self, id: &RoomId) -> anyhow::Result<Option<Avatar>>;
async fn join(&self, room_id: &RoomId) -> anyhow::Result<bool>;
}
#[async_trait(?Send)]

View File

@@ -314,4 +314,10 @@ impl RoomStoreConsumerInterface for Room {
fn spaces(&self) -> &Vec<SpaceId> {
&self.spaces
}
async fn join(&self) {
if let Some(messaging_provider) = &self.messaging_provider {
let _ = messaging_provider.join(&self.id).await;
}
}
}

View File

@@ -29,11 +29,11 @@ pub trait RoomStoreConsumerInterface {
fn is_direct(&self) -> Option<bool>;
fn name(&self) -> Option<String>;
fn topic(&self) -> Option<String>;
fn spaces(&self) -> &Vec<SpaceId>;
#[allow(dead_code)]
async fn avatar(&self) -> Option<Avatar>;
fn spaces(&self) -> &Vec<SpaceId>;
async fn join(&self);
}
pub trait RoomStoreProviderInterface {