From 585d6aab0036edb2c6a536f4cb2e70f68aa59349 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 17 Oct 2024 12:26:41 -0700 Subject: [PATCH] replace id with topic --- .../src/storage/encrypted_store/v2_conversation.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xmtp_mls/src/storage/encrypted_store/v2_conversation.rs b/xmtp_mls/src/storage/encrypted_store/v2_conversation.rs index 9080d95e7..8f6be413b 100644 --- a/xmtp_mls/src/storage/encrypted_store/v2_conversation.rs +++ b/xmtp_mls/src/storage/encrypted_store/v2_conversation.rs @@ -74,16 +74,16 @@ impl DbConnection { .optional()?; if maybe_inserted_conversation.is_none() { - let existing_conversation: StoredV2Conversation = dsl::v2_conversations.find(v2_conversation.id).first(conn)?; - if existing_conversation.welcome_id == v2_conversation.welcome_id { + let existing_conversation: StoredV2Conversation = dsl::v2_conversations.find(v2_conversation.topic).first(conn)?; + if existing_conversation.topic == v2_conversation.topic { tracing::info!("V2 Conversation invite already exists"); // Error so OpenMLS db transaction are rolled back on duplicate welcomes return Err(StorageError::Duplicate(DuplicateItem::WelcomeId( - existing_group.welcome_id, + existing_conversation.topic, ))); } else { tracing::info!("V2 Conversation already exists"); - return Ok(existing_group); + return Ok(existing_conversation); } } else { tracing::info!("V2 Conversation is inserted"); @@ -91,7 +91,7 @@ impl DbConnection { match maybe_inserted_conversation { Some(v2_conversation) => Ok(v2_conversation), - None => Ok(dsl::v2_conversations.find(v2_conversation.id).first(conn)?), + None => Ok(dsl::v2_conversations.find(v2_conversation.topic).first(conn)?), } })?;