From 379a28c9e5a98822b170750ab215575ab611498f Mon Sep 17 00:00:00 2001 From: cameronvoell Date: Wed, 18 Dec 2024 16:53:56 -0800 Subject: [PATCH] add content type filtering to bindings --- bindings_ffi/src/mls.rs | 1 + xmtp_mls/src/storage/encrypted_store/group_message.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 4ac46b3c1..3eb4a7d98 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -1258,6 +1258,7 @@ pub struct FfiListMessagesOptions { pub limit: Option, pub delivery_status: Option, pub direction: Option, + pub content_types: Option>, } #[derive(uniffi::Record, Clone, Default)] diff --git a/xmtp_mls/src/storage/encrypted_store/group_message.rs b/xmtp_mls/src/storage/encrypted_store/group_message.rs index 9d4178ea2..550edb752 100644 --- a/xmtp_mls/src/storage/encrypted_store/group_message.rs +++ b/xmtp_mls/src/storage/encrypted_store/group_message.rs @@ -186,6 +186,7 @@ pub struct MsgQueryArgs { delivery_status: Option, limit: Option, direction: Option, + content_types: Option>, } impl MsgQueryArgs { @@ -273,6 +274,10 @@ impl DbConnection { query = query.filter(dsl::delivery_status.eq(status)); } + if let Some(content_types) = &args.content_types { + query = query.filter(dsl::content_type.eq_any(content_types)); + } + query = match args.direction.as_ref().unwrap_or(&SortDirection::Ascending) { SortDirection::Ascending => query.order(dsl::sent_at_ns.asc()), SortDirection::Descending => query.order(dsl::sent_at_ns.desc()),