Respect protected content for photos in rich text messages
dallo28 committed
- Author
- dallo28 · 61457974+dallo28@users.noreply.github.comOct 16, 2026 at 18:09
- Committer
- dallo28 · 61457974+dallo28@users.noreply.github.comOct 16, 2026 at 18:09
- Parents
- f32ffeec763f
Respect protected content for photos in rich text messages Photos inside a rich text message are opened through ChatActivity.openArticlePhoto(), which uses PhotoViewer's page-block mode (originally built for Instant View). That entry point passes no MessageObject and dialogId 0, so the no-forwards check in page-block mode (isPeerNoForwards(currentDialogId)) always passed: "Save to Gallery", "Open in" and "Save GIF" stayed available and FLAG_SECURE was never set, even in chats with protected content or private chats with Disable Sharing on. Resolve protection from the adapter's parent MessageObject (peer no-forwards, per-message noforwards, revealed paid media) and use it to compute allowShare, hide the Save to Gallery button, guard the save action, and apply FLAG_SECURE. Instant View articles, whose parent is the page itself, are unaffected. Also reset the "Stop downloading" item in onPhotoShow() together with the other menu items. It kept its initial VISIBLE state on the first open, so checkHideMenuItem() left the "more" button visible; with "Save to Gallery" hidden this showed an empty popup. checkProgress() still shows the item when the media is actually loading. Fixes https://bugs.telegram.org/c/64694 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed+23−4