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 19, 2024
1 parent c6b6eac commit e9f928a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 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 All @@ -392,7 +394,7 @@ where
}

// don't send session enders as sealed sender
if end_session {
if end_session || sync_message {
unidentified_access.take();
}

Expand Down

0 comments on commit e9f928a

Please sign in to comment.