Repository navigation
Conversation
The message menu hides Copy in chats with saving content restricted, but the Translate window still offered Copy to Clipboard, a copy button, text selection and a right-click Copy. For a copy-protected message, or one that can't be found, the window now hides them and turns off selection and the text menu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key change
In chats with saving content restricted, the Translate window no longer lets the text out. Before, the message menu hid Copy, but Translate was still offered, and its window had a Copy to Clipboard row and a copy button next to the translation, and both the original and the translated text could be selected or copied word by word from the right-click menu. Now, for a protected message, the window shows the translation without these controls, and the text can't be selected or copied. Translation itself still works, as on iOS.
Reason
The message menu hides Copy for protected messages (
protectedinChatMessageMenuItems.swift), but the Translate item has no such check, andTranslateModalControllerdidn't know about the protection.The window now checks its message with the rule the menu uses (
Message.isCopyProtected(cachedData:): the message's own protection flag, the chat's copy protection, thecopyProtectionEnabledflags of a private chat, and self-destructing media). If the message is protected, or can't be found,TranslateModalControllerhides the Copy to Clipboard row and the copy button, andTranslateTableRowItemturns off selection and the text's right-click menu for both rows. Windows opened without a message (the input field, the AI editor) are unchanged.iOS passes
canCopy: !isCopyProtectedto its translate screen (ChatInterfaceStateContextMenus.swift).Steps in Telegram 13.1.0 (283357):
Screenshot/video result (before/after)
Before
The message menu has Translate but no Copy:

The Translate window has Copy to Clipboard and a copy button:

Copying works:

The text is pasted into the input field:

After
The same message: the translation without copy controls:

In a chat without restrictions, the controls are still there:

Confirmation
Tested on macOS 26.6.2 (25G83), Apple M3. Before: Telegram 13.1.0 (283357). After: local Debug build of this branch, based on 78be930.
Limitations: tested only on macOS 26.6.2. For Articles, the copy button in a code block's header still copies the code, as it does in the chat itself for protected Articles; that is not changed here.