From f6247cebf437cbac547a8941064134b62039bf78 Mon Sep 17 00:00:00 2001 From: Schmiddiii Date: Mon, 18 Nov 2024 18:49:39 +0100 Subject: [PATCH] Fix empty sync messages being sent This happened when giving `send_message` a `SyncMessage` to one self. In that case, the message would not be sent and instead `create_multi_device_sent_transcript_content` would create a new sync message, which is empty as the `SyncMessage` is neither a `DataMessage` nor an `EditMessage`. This PR changes the condition to ignore sync messages. --- src/sender.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sender.rs b/src/sender.rs index a2d20c037..025a2fd28 100644 --- a/src/sender.rs +++ b/src/sender.rs @@ -358,6 +358,8 @@ where ) -> SendMessageResult { let content_body = message.into(); let message_to_self = recipient == &self.local_aci; + let sync_message = + matches!(content_body, ContentBody::SynchronizeMessage(..)); let is_multi_device = self.is_multi_device().await; use crate::proto::data_message::Flags; @@ -370,7 +372,7 @@ where }; // only send a sync message when sending to self and skip the rest of the process - if message_to_self && is_multi_device { + if message_to_self && is_multi_device && !sync_message { debug!("sending note to self"); let sync_message = self .create_multi_device_sent_transcript_content(