Skip to content

Commit

Permalink
Fix empty sync messages being sent
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Schmiddiii committed Nov 18, 2024
1 parent c6b6eac commit f6247ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down

0 comments on commit f6247ce

Please sign in to comment.