Repository navigation
enhance: allow admins to enforce public user activity - #40002
SHIVANSHGARG07 wants to merge 8 commits into
Conversation
Adds a new USER_DISABLED_FEATURES option (change_activity_visibility) so admins can lock the 'Hide Activity from profile page' checkbox, mirroring the existing change_username/change_full_name guards. Fixes: go-gitea#37961
|
Hello @maintainers can you please review this. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
bircni
left a comment
There was a problem hiding this comment.
- The API isn't guarded. routers/api/v1/user/settings.go:57 still applies HideActivity from PATCH /user/settings, so any user can bypass the lock through the API.
- The option isn't documented. custom/conf/app.example.ini:1729-1730 lists change_username and change_full_name but not change_activity_visibility.
--> fixing it
Treat activity as public when admins disable change_activity_visibility, regardless of a previously stored preference, which is kept so it applies again if the lock is lifted. Also guard the API settings endpoint and document the option. Assisted-by: Claude Code:claude-opus-5-5
Return 403 from PATCH /user/settings when the change is locked, explain the disabled checkbox in the UI and skip the activity SQL filter when everyone is forced public. Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
Pushed a few follow-ups on top:
Assisted by Claude Code (claude-opus-5-5) |
bircni
left a comment
There was a problem hiding this comment.
lgtm now - pls also update the docs repo
…ty-visibility # Conflicts: # tests/integration/api_user_update_test.go
Assisted-by: Augment Code:Claude Sonnet 4.5
|
| ;; - manage_credentials: a user cannot configure emails, passwords, or openid | ||
| ;; - change_username: a user cannot change their username | ||
| ;; - change_full_name: a user cannot change their full name | ||
| ;; - change_activity_visibility: a user cannot hide their activity, existing hidden activity becomes public |
There was a problem hiding this comment.
It's really a strange design that "disabling change_activity_visibility" means "force public".
And future developers need to keep remembering that KeepActivityPrivate / keep_activity_private should never be used. It is very fragile.
There was a problem hiding this comment.
Maybe you need to think more about design.
For example: there is "repo force private", then
will share one design doc and start working after approved |
Assisted-by: Augment Agent: GPT-5.6
|
I redesigned this PR based on the feedback about The activity policy is now explicit: When force-public mode is enabled, the web/API settings cannot enable private activity, the UI control is disabled, and the stored preference is preserved. Disabling the policy restores the user's previous preference. I also updated configuration documentation, generated Swagger, unit/integration coverage, and tests for API, UI, activity feeds, heatmaps, and preference restoration. The branch was merged with upstream Please review the redesigned architecture and mergeability. Assisted-by: Augment Agent: GPT-5.6 Luna |
…isable-activity-visibility
|
Adds a
change_activity_visibilityoption toUSER_DISABLED_FEATURES/EXTERNAL_USER_DISABLE_FEATURESso admins can enforce public user activity, e.g. for company instances that require it.When set, the "Hide Activity" checkbox is locked and every user's activity is treated as public, including users who had hidden it before. The stored preference is kept, so it applies again if the option is removed. The API settings endpoint rejects hiding activity (and changing a locked full name, which was previously unguarded).
Fixes #37961
Screenshots
Before
After
Config used