Skip to content

Commit

Permalink
add filter
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Jan 22, 2025
1 parent 6f37207 commit 1f89a63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion xmtp_mls/src/groups/device_sync/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ mod tests {
.conn_ref()
.raw_query(|conn| group_messages::table.load(conn))
.unwrap();
assert_eq!(messages.len(), 2);
// Only the application messages should sync
assert_eq!(messages.len(), 1);
for msg in messages {
let old_msg = old_messages.iter().find(|m| msg.id == m.id).unwrap();
assert_eq!(old_msg.authority_id, msg.authority_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ impl BackupRecordProvider for GroupSave {
where
Self: Sized,
{
let mut query = groups::table.order_by(groups::id).into_boxed();
let mut query = groups::table
.filter(groups::conversation_type.ne(ConversationType::Sync))
.order_by(groups::id)
.into_boxed();

if let Some(start_ns) = streamer.start_ns {
query = query.filter(groups::created_at_ns.gt(start_ns));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ impl BackupRecordProvider for GroupMessageSave {
Self: Sized,
{
let mut query = group_messages::table
.filter(group_messages::kind.eq(GroupMessageKind::Application))
.order_by(group_messages::id)
.into_boxed();

Expand Down

0 comments on commit 1f89a63

Please sign in to comment.