Skip to content

fix: remove deleted messages from shared media index to fix incorrect counts#385

Open
denfry wants to merge 1 commit into
AyuGram:devfrom
denfry:fix/shared-media-count-on-delete
Open

fix: remove deleted messages from shared media index to fix incorrect counts#385
denfry wants to merge 1 commit into
AyuGram:devfrom
denfry:fix/shared-media-count-on-delete

Conversation

@denfry

@denfry denfry commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • When saveDeletedMessages is on, messages are kept in memory via setDeleted() instead of destroy()
  • destroy() goes through History::destroyMessage() which dispatches SharedMediaRemoveOne to update the Photos/Links/Files counts in the peer profile
  • setDeleted() did not call removeFromSharedMediaIndex(), so deleted messages remained counted in the shared media totals
  • The counts would only reset on app restart (when the in-memory items are gone)

Fix

Call removeFromSharedMediaIndex() at the end of setDeleted() so the shared media counts stay accurate when a message is marked as deleted.

Closes #174


This PR was AI generated.

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.

Shared Link & Photos count is wrong if messages deleted

1 participant