Skip to content

Allow owners/admins to bypass 'Restrict saving content' and add owner-controlled override toggle#15

Merged
Rocket-Space merged 1 commit intomasterfrom
codex/add-option-to-override-content-restriction
Feb 25, 2026
Merged

Allow owners/admins to bypass 'Restrict saving content' and add owner-controlled override toggle#15
Rocket-Space merged 1 commit intomasterfrom
codex/add-option-to-override-content-restriction

Conversation

@Rocket-Space
Copy link
Owner

Motivation

  • Owners reported that enabling “Restrict saving content” (noforwards) also blocked the group owner and admins, while the owner should be exempt and able to let admins be exempt as well.
  • Provide an owner-controlled, per-chat option to allow admins to bypass the no-forwards restriction when the owner wants to.
  • Make the new option visible and translatable so users in other locales understand the toggle.

Description

  • Modified isChatNoForwards(...) to bypass the restriction for the chat creator and to allow admins to bypass when a per-chat setting is enabled by the owner by introducing shouldBypassNoForwardsForCurrentUser(...) and using it for migrated chats as well.
  • Added persistent per-chat getters/setters: isNoForwardsAdminsBypassEnabled(...) and setNoForwardsAdminsBypassEnabled(...) that store the owner-controlled admin-bypass flag.
  • Added a new toggle UI in ChatEditTypeActivity (saveRestrictAdminBypassCell) labeled by the new string OverrideRestriction, shown to the owner only when Restrict saving content is enabled, and wired to persist the setting when saving the chat type.
  • Added translation string OverrideRestriction to base values/strings.xml and to values-es, values-pt-rBR, values-ru, and values-ar.

Testing

  • Attempted to compile Java with ./gradlew :TMessagesProj:compileDebugJavaWithJavac -x lint, but the build failed due to the environment/toolchain (Unsupported class file major version 69), so no full compile test completed.
  • No other automated tests were run in this environment; code diffs were inspected and a runtime UI change was implemented in ChatEditTypeActivity to reflect the new toggle behavior.

Codex Task

@Rocket-Space Rocket-Space merged commit 584735a into master Feb 25, 2026
1 check passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 200c4ef144

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +6601 to +6604
public void setNoForwardsAdminsBypassEnabled(long chatId, boolean enabled) {
SharedPreferences.Editor editor = getMainSettings().edit();
editor.putBoolean(getNoForwardsAdminsBypassKey(chatId), enabled);
editor.apply();

Choose a reason for hiding this comment

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

P1 Badge Persist admin bypass in chat state, not device-local prefs

setNoForwardsAdminsBypassEnabled writes the override flag into mainPreferences, which is local to a single client install, and shouldBypassNoForwardsForCurrentUser relies on that same local key for admin bypass decisions. This means an owner enabling the toggle does not propagate to other admins (or even the owner's other devices), so admins still cannot bypass noforwards despite the owner having enabled the option.

Useful? React with 👍 / 👎.

Rocket-Space added a commit that referenced this pull request Feb 25, 2026
…override-content-restriction"

This reverts commit 584735a, reversing
changes made to 530a954.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant