Skip to content

fix: Emit MsgsChanged instead of MsgsNoticed on self-MDN if chat still has fresh messages#7741

Merged
iequidoo merged 1 commit into
mainfrom
iequidoo/no-MsgsNoticed-on-more-fresh-msgs
Jan 20, 2026
Merged

fix: Emit MsgsChanged instead of MsgsNoticed on self-MDN if chat still has fresh messages#7741
iequidoo merged 1 commit into
mainfrom
iequidoo/no-MsgsNoticed-on-more-fresh-msgs

Conversation

@iequidoo
Copy link
Copy Markdown
Collaborator

@iequidoo iequidoo commented Jan 19, 2026

Otherwise if the user reads messages being offline and then the device comes online, sent MDNs will remove all notifications from other devices even if new messages have arrived. Notifications not removed at all look more acceptable.

This is a follow-up PR as suggested in #7738 (comment). The idea comes from #7659.
Checked this in Desktop. Can add a test if the change is agreed, but as the w/a for a not updated profile badge counter looks weird and may not work in all UIs, maybe we should emit another event.

Comment thread src/receive_imf.rs Outdated
Comment thread src/receive_imf.rs Outdated
context.emit_event(EventType::MsgsNoticed(chat_id));
} else {
// W/a for a not updated profile badge counter in Desktop v2.35.0.
context.emit_event(EventType::MsgsNoticed(DC_CHAT_ID_TRASH));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Usually, we use MsgId::new(0) if we don't want to specify a MsgId in events. This doesn't work here? And MsgsChanged also doesn't work?

Copy link
Copy Markdown
Collaborator Author

@iequidoo iequidoo Jan 20, 2026

Choose a reason for hiding this comment

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

Thanks, MsgsChanged works in Desktop and it's not hacky at all, should work in all UIs. Then i'm going to add a test and merge this.
EDIT: MsgsChanged also allows to specify the chat it which is good.

@iequidoo iequidoo marked this pull request as draft January 20, 2026 08:15
@iequidoo iequidoo force-pushed the iequidoo/no-MsgsNoticed-on-more-fresh-msgs branch from 134a693 to b4d3f0e Compare January 20, 2026 17:05
@iequidoo iequidoo marked this pull request as ready for review January 20, 2026 17:06
@iequidoo iequidoo changed the title fix: Don't emit MsgsNoticed on self-MDN if chat has fresh messages fix: Emit MsgsChanged instead of MsgsNoticed on self-MDN if chat still has fresh messages Jan 20, 2026
…l has fresh messages

Otherwise if the user reads messages being offline and then the device comes online, sent MDNs will
remove all notifications from other devices even if new messages have arrived. Notifications not
removed at all look more acceptable.
@iequidoo iequidoo force-pushed the iequidoo/no-MsgsNoticed-on-more-fresh-msgs branch from b4d3f0e to 0f0b012 Compare January 20, 2026 21:22
@iequidoo
Copy link
Copy Markdown
Collaborator Author

Tried to add a test, but it only works if Session::sync_seen_flags() is removed (which should be done after one release probably). Let's merge this as is and move the test to a separate PR

@iequidoo iequidoo merged commit 566395f into main Jan 20, 2026
30 checks passed
@iequidoo iequidoo deleted the iequidoo/no-MsgsNoticed-on-more-fresh-msgs branch January 20, 2026 21:34
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.

3 participants