Skip to content

Commit

Permalink
fix: skipping sync group message from other device (#251)
Browse files Browse the repository at this point in the history
Such messages were skipped because, we assumed that profile key is
always set, which is not the case for sync group messages.
  • Loading branch information
boxdot authored Nov 14, 2023
1 parent b57c385 commit 791dabb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ use presage::prelude::{
};
use regex_automata::Regex;
use tokio::sync::mpsc;
use tracing::{error, info, warn};
use tracing::{error, info, trace, warn};
use uuid::Uuid;

use std::borrow::Cow;
@@ -496,7 +496,7 @@ impl App {
message:
Some(DataMessage {
mut body,
profile_key: Some(profile_key),
profile_key,
group_v2,
quote,
attachments: attachment_pointers,
@@ -524,6 +524,7 @@ impl App {
.context("failed to create group channel")?
} else if let Some(destination_uuid) = destination_uuid {
let profile_key = profile_key
.context("sync message with destination without profile key")?
.try_into()
.map_err(|_| anyhow!("invalid profile key"))?;
let destination_uuid = Uuid::parse_str(&destination_uuid).unwrap();
@@ -795,7 +796,10 @@ impl App {
return Ok(());
}

_ => return Ok(()),
unhandled => {
trace!(?unhandled, "skipping unhandled message");
return Ok(());
}
};

self.add_message_to_channel(channel_idx, message);

0 comments on commit 791dabb

Please sign in to comment.