diff --git a/xmtp_mls/src/client.rs b/xmtp_mls/src/client.rs index 42e9e1b99..25c690131 100644 --- a/xmtp_mls/src/client.rs +++ b/xmtp_mls/src/client.rs @@ -206,9 +206,13 @@ where ) -> Result, ClientError> { log::info!("creating group"); - // EM: Consider setting host id here as self? - let group = MlsGroup::create_and_insert(self, GroupMembershipState::Allowed, permissions) - .map_err(|e| ClientError::Generic(format!("group create error {}", e)))?; + let group = MlsGroup::create_and_insert( + self, + GroupMembershipState::Allowed, + permissions, + Some(self.account_address(), + )) + .map_err(|e| ClientError::Generic(format!("group create error {}", e)))?; Ok(group) } diff --git a/xmtp_mls/src/groups/mod.rs b/xmtp_mls/src/groups/mod.rs index 901a8f885..f09dac463 100644 --- a/xmtp_mls/src/groups/mod.rs +++ b/xmtp_mls/src/groups/mod.rs @@ -181,12 +181,12 @@ where } // Create a new group and save it to the DB - // EM: Consider passing in added_by_id here..... #[allow(clippy::unwrap_or_default)] pub fn create_and_insert( client: &'c Client, membership_state: GroupMembershipState, permissions: Option, + added_by_address: Option, ) -> Result { let conn = client.store.conn()?; let provider = XmtpOpenMlsProvider::new(&conn); @@ -210,11 +210,9 @@ where mls_group.save(provider.key_store())?; let group_id = mls_group.group_id().to_vec(); - // EM: Pass in now added by address - let stored_group = StoredGroup::new(group_id.clone(), now_ns(), membership_state, None); + let stored_group = StoredGroup::new(group_id.clone(), now_ns(), membership_state, added_by_address.clone()); stored_group.store(provider.conn())?; - // EM: Consider passing in added_by_address here..... - Ok(Self::new(client, group_id, stored_group.created_at_ns, None)) + Ok(Self::new(client, group_id, stored_group.created_at_ns, added_by_address)) } // Create a group from a decrypted and decoded welcome message @@ -232,7 +230,6 @@ where mls_group.save(provider.key_store())?; let group_id = mls_group.group_id().to_vec(); - // EM: Store new added_by_address here let to_store = StoredGroup::new(group_id, now_ns(), GroupMembershipState::Pending, added_by_address.clone()); let stored_group = provider.conn().insert_or_ignore_group(to_store)?;