Update DirectV1 to support multiple members

This commit is contained in:
Jazz Turner-Baggs 2026-06-18 17:44:14 -07:00
parent 065b37b1e7
commit 206314bbef
No known key found for this signature in database
2 changed files with 9 additions and 4 deletions

View File

@ -9,18 +9,23 @@ use crate::{
type DelegateGroup = GroupV1Convo; type DelegateGroup = GroupV1Convo;
/// A Conversation between two participants.
#[derive(Debug)] #[derive(Debug)]
pub struct DirectV1Convo { pub struct DirectV1Convo {
inner_group: DelegateGroup, inner_group: DelegateGroup,
} }
impl DirectV1Convo { impl DirectV1Convo {
// Constructor must accept multiple IdentId's
// While the conversation is limited to 2 participants, each participants may
// have multiple Installations.
pub fn new<S: ExternalServices>( pub fn new<S: ExternalServices>(
cx: &mut ServiceContext<S>, cx: &mut ServiceContext<S>,
participant: IdentIdRef, // Constructor must accept multiple
members: &[IdentIdRef],
) -> Result<Self, ChatError> { ) -> Result<Self, ChatError> {
let mut inner_group = DelegateGroup::new(cx)?; let mut inner_group = DelegateGroup::new(cx)?;
inner_group.add_member(cx, &[participant])?; inner_group.add_member(cx, members)?;
Ok(Self { inner_group }) Ok(Self { inner_group })
} }
} }

View File

@ -215,9 +215,9 @@ impl<'a, S: ExternalServices + 'static> Core<S> {
pub fn create_direct_convo_v1( pub fn create_direct_convo_v1(
&mut self, &mut self,
pariticpant: IdentIdRef, members: &[IdentIdRef],
) -> Result<ConversationId, ChatError> { ) -> Result<ConversationId, ChatError> {
let convo = DirectV1Convo::new(&mut self.services, pariticpant)?; let convo = DirectV1Convo::new(&mut self.services, members)?;
let convo_id = convo.id().to_string(); let convo_id = convo.id().to_string();
self.register_convo(ConvoTypeOwned::Direct(Box::new(convo)))?; self.register_convo(ConvoTypeOwned::Direct(Box::new(convo)))?;