diff --git a/core/conversations/src/conversation.rs b/core/conversations/src/conversation.rs index 011be51..c184fbe 100644 --- a/core/conversations/src/conversation.rs +++ b/core/conversations/src/conversation.rs @@ -10,6 +10,7 @@ pub use privatev1::PrivateV1Convo; use shared_traits::IdentIdRef; pub type ConversationId = String; +pub type ConversationIdRef<'a> = &'a str; /// Behaviour shared by every conversation kind. pub(crate) trait Convo { @@ -37,4 +38,6 @@ pub(crate) trait GroupConvo: Convo { cx: &mut ServiceContext, members: &[IdentIdRef], ) -> Result<(), ChatError>; + + fn id(&self) -> ConversationIdRef<'_>; } diff --git a/core/conversations/src/conversation/group_v1.rs b/core/conversations/src/conversation/group_v1.rs index 99b79fa..3763eb6 100644 --- a/core/conversations/src/conversation/group_v1.rs +++ b/core/conversations/src/conversation/group_v1.rs @@ -344,4 +344,8 @@ impl GroupConvo for GroupV1Convo { .publish(env) .map_err(|e| ChatError::Generic(format!("Publish: {e}"))) } + + fn id(&self) -> super::ConversationIdRef<'_> { + &self.convo_id + } }