Skip to content

Do not send MDNs for hidden messages#7991

Merged
link2xt merged 1 commit intomainfrom
link2xt/no-hidden-mdn
Mar 15, 2026
Merged

Do not send MDNs for hidden messages#7991
link2xt merged 1 commit intomainfrom
link2xt/no-hidden-mdn

Conversation

@link2xt
Copy link
Collaborator

@link2xt link2xt commented Mar 15, 2026

Hidden messages are marked as seen
when chat is marked as noticed.
MDNs to such messages should not be sent
as this notifies the hidden message sender
that the chat was opened.

The issue discovered by Frank Seifferth.

When chat is marked as noticed, hidden messages are marked as seen here:

core/src/chat.rs

Lines 3305 to 3322 in bf02785

// This is to trigger emitting `MsgsNoticed` on other devices when reactions are noticed
// locally (i.e. when the chat was opened locally).
let hidden_messages = context
.sql
.query_map_vec(
"SELECT id FROM msgs
WHERE state=?
AND hidden=1
AND chat_id=?
ORDER BY id LIMIT 100", // LIMIT to 100 in order to avoid blocking the UI too long, usually there will be less than 100 messages anyway
(MessageState::InFresh, chat_id), // No need to check for InNoticed messages, because reactions are never InNoticed
|row| {
let msg_id: MsgId = row.get(0)?;
Ok(msg_id)
},
)
.await?;
message::markseen_msgs(context, hidden_messages).await?;

@link2xt link2xt force-pushed the link2xt/no-hidden-mdn branch 2 times, most recently from 4c270c4 to 5150b95 Compare March 15, 2026 14:00
@link2xt link2xt marked this pull request as ready for review March 15, 2026 14:28
@link2xt link2xt requested a review from Hocuri March 15, 2026 14:33
// We also don't send read receipts for contact requests.
// Read receipts will not be sent even after accepting the chat.
let to_id = if curr_blocked == Blocked::Not
&& !curr_hidden
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, i also saw this logic, but was never thinking it's a problem because if the contact is accepted, why hide the fact we've noticed reactions from it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that you can even send empty reaction message (removing reaction) and then there is no notification or anything visible, but hidden message is still added and MDN is sent when you open the chat.

There is anyway no double checkmark for hidden messages, so this is just wasting the traffic and storage and bumps "last seen" so green dot appears.

@iequidoo
Copy link
Collaborator

iequidoo commented Mar 15, 2026

The similar problem: i opened a chat on Desktop and forgot about it. If the contact sends me a message, it immediately receives an MDN which reveals that the chat is open on my device.

Basically the problem is: you don't do anything that assumes sending MDNs to accepted contacts, but they are sent anyway and that reveals some of your state or previous actions.

Copy link
Collaborator

@iequidoo iequidoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, apart from other similar problems, this makes sense because marking a chat as noticed shouldn't send any MDNs to contacts. Would be good to send MDNs to self however, to remove notifications for reactions.

EDIT: MDNs to self are sent as previously. No further changes are needed.

Hidden messages are marked as seen
when chat is marked as noticed.
MDNs to such messages should not be sent
as this notifies the hidden message sender
that the chat was opened.

The issue discovered by Frank Seifferth.
@link2xt link2xt force-pushed the link2xt/no-hidden-mdn branch from 5150b95 to ad91e7e Compare March 15, 2026 18:26
@link2xt link2xt merged commit 822a99e into main Mar 15, 2026
55 of 56 checks passed
@link2xt link2xt deleted the link2xt/no-hidden-mdn branch March 15, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants