From be731a9fc374bf1183acc77afd4cb5de83f14309 Mon Sep 17 00:00:00 2001 From: Dakota Brink Date: Thu, 30 Jan 2025 09:07:32 -0500 Subject: [PATCH] reload the group --- xmtp_mls/src/client.rs | 2 +- xmtp_mls/src/groups/mls_ext.rs | 4 +++- .../groups/mls_ext/{welcome_ext.rs => mls_ext_welcome.rs} | 0 xmtp_mls/src/groups/mls_sync.rs | 8 ++++++-- xmtp_mls/src/groups/mod.rs | 2 +- xmtp_mls/src/subscriptions/stream_conversations.rs | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) rename xmtp_mls/src/groups/mls_ext/{welcome_ext.rs => mls_ext_welcome.rs} (100%) diff --git a/xmtp_mls/src/client.rs b/xmtp_mls/src/client.rs index 5a630e74c..d7f5657be 100644 --- a/xmtp_mls/src/client.rs +++ b/xmtp_mls/src/client.rs @@ -25,7 +25,7 @@ use xmtp_proto::xmtp::mls::api::v1::{welcome_message, GroupMessage, WelcomeMessa #[cfg(any(test, feature = "test-utils"))] use crate::groups::device_sync::WorkerHandle; -use crate::groups::{mls_ext::welcome_ext::DecryptedWelcome, ConversationListItem}; +use crate::groups::{mls_ext::DecryptedWelcome, ConversationListItem}; use crate::{ api::ApiClientWrapper, groups::{ diff --git a/xmtp_mls/src/groups/mls_ext.rs b/xmtp_mls/src/groups/mls_ext.rs index 919159e5e..8642fce6f 100644 --- a/xmtp_mls/src/groups/mls_ext.rs +++ b/xmtp_mls/src/groups/mls_ext.rs @@ -1 +1,3 @@ -pub mod welcome_ext; +mod mls_ext_welcome; + +pub(crate) use mls_ext_welcome::*; diff --git a/xmtp_mls/src/groups/mls_ext/welcome_ext.rs b/xmtp_mls/src/groups/mls_ext/mls_ext_welcome.rs similarity index 100% rename from xmtp_mls/src/groups/mls_ext/welcome_ext.rs rename to xmtp_mls/src/groups/mls_ext/mls_ext_welcome.rs diff --git a/xmtp_mls/src/groups/mls_sync.rs b/xmtp_mls/src/groups/mls_sync.rs index 49c70ff6e..bfd17d693 100644 --- a/xmtp_mls/src/groups/mls_sync.rs +++ b/xmtp_mls/src/groups/mls_sync.rs @@ -554,9 +554,13 @@ where if !matches!(result, Err(StorageError::IntentionalRollback)) { result?; } - let processed_message = processed_message.expect("Was just set to Some")?; + // Reload the mlsgroup + let mls_group_reload = OpenMlsGroup::load(provider.storage(), mls_group.group_id())? + .expect("Mls group is currently loaded"); + let _ = std::mem::replace(mls_group, mls_group_reload); + let (sender_inbox_id, sender_installation_id) = extract_message_sender(mls_group, &processed_message, envelope_timestamp_ns)?; @@ -601,7 +605,7 @@ where }; provider.transaction(|provider| { - let processed_message = mls_group.process_message(provider, message)?; + // let processed_message = mls_group.process_message(provider, message)?; let mut validated_commit = None; if let ProcessedMessageContent::StagedCommitMessage(staged_commit) = diff --git a/xmtp_mls/src/groups/mod.rs b/xmtp_mls/src/groups/mod.rs index 48f46074b..60d33d7a1 100644 --- a/xmtp_mls/src/groups/mod.rs +++ b/xmtp_mls/src/groups/mod.rs @@ -15,7 +15,7 @@ pub mod validated_commit; use device_sync::preference_sync::UserPreferenceUpdate; use intents::SendMessageIntentData; -use mls_ext::welcome_ext::build_group_join_config; +use mls_ext::build_group_join_config; use mls_sync::GroupMessageProcessingError; use openmls::{ credentials::CredentialType, diff --git a/xmtp_mls/src/subscriptions/stream_conversations.rs b/xmtp_mls/src/subscriptions/stream_conversations.rs index d233ef882..bc7dcf0fd 100644 --- a/xmtp_mls/src/subscriptions/stream_conversations.rs +++ b/xmtp_mls/src/subscriptions/stream_conversations.rs @@ -1,6 +1,6 @@ use super::{LocalEvents, Result, SubscribeError}; use crate::{ - groups::{mls_ext::welcome_ext::DecryptedWelcome, scoped_client::ScopedGroupClient, MlsGroup}, + groups::{mls_ext::DecryptedWelcome, scoped_client::ScopedGroupClient, MlsGroup}, storage::{group::ConversationType, refresh_state::EntityKind, NotFound}, Client, XmtpOpenMlsProvider, };