Allow owners/admins to bypass 'Restrict saving content' and add owner-controlled override toggle#15
Conversation
There was a problem hiding this comment.
💡 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".
| public void setNoForwardsAdminsBypassEnabled(long chatId, boolean enabled) { | ||
| SharedPreferences.Editor editor = getMainSettings().edit(); | ||
| editor.putBoolean(getNoForwardsAdminsBypassKey(chatId), enabled); | ||
| editor.apply(); |
There was a problem hiding this comment.
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 👍 / 👎.
Motivation
noforwards) also blocked the group owner and admins, while the owner should be exempt and able to let admins be exempt as well.Description
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 introducingshouldBypassNoForwardsForCurrentUser(...)and using it for migrated chats as well.isNoForwardsAdminsBypassEnabled(...)andsetNoForwardsAdminsBypassEnabled(...)that store the owner-controlled admin-bypass flag.ChatEditTypeActivity(saveRestrictAdminBypassCell) labeled by the new stringOverrideRestriction, shown to the owner only whenRestrict saving contentis enabled, and wired to persist the setting when saving the chat type.OverrideRestrictionto basevalues/strings.xmland tovalues-es,values-pt-rBR,values-ru, andvalues-ar.Testing
./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.ChatEditTypeActivityto reflect the new toggle behavior.Codex Task