Skip to content

Move organization's visibility change to danger zone. #34814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

lunny
Copy link
Member

@lunny lunny commented Jun 21, 2025

image image

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Jun 21, 2025
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 21, 2025
@github-actions github-actions bot added modifies/translation modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Jun 21, 2025
@lunny lunny marked this pull request as draft June 22, 2025 17:35
@lunny lunny marked this pull request as ready for review July 1, 2025 19:01
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 3, 2025
@lunny lunny requested a review from wxiaoguang July 5, 2025 00:11
@lunny lunny added this to the 1.25.0 milestone Jul 8, 2025
@@ -0,0 +1,25 @@
function initOrgVisibilityChange() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid introducing this kind of JS code?

Do you mean that in the future we need to introduce JS code for almost every form or modal?

Copy link
Member Author

Choose a reason for hiding this comment

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

I’ve identified the issue as well. It seems we need to use inline JavaScript unless we refactor the modal using a Vue template. Do you have any suggestions on how we might handle this more cleanly?

Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor the "areYouSure dirty-form check" code first, only allow changed (dirty) form to submit.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. I revert the related change to allow another PR do it from a framework layer. ecc5b72

settings.change_visibility_notices_1 = This operation <strong>CANNOT</strong> be undone.
settings.change_visibility_notices_2 = Non-members will lose access to the organization’s repositories if visibility is changed to private.
settings.change_visibility_no_change = You did not make any changes to visibility.
settings.change_visibility_failed = Failed to change the visibility of %s due to an internal error.
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, we need to introduce various "failed ... due to an internal error" messages for every route handler?

Copy link
Member Author

Choose a reason for hiding this comment

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

Even we have a common sentence like Failed to xxx due to an internal error, we still have to translate change the visibility of %s? So that it's difficult to reuse these sentences.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why such message is needed?

"Internal error" should never (seldom) happen to users, even they see the message, the message helps nothing and they can do nothing.

@@ -2840,6 +2840,14 @@ settings.location = Location
settings.permission = Permissions
settings.repoadminchangeteam = Repository admin can add and remove access for teams
settings.visibility = Visibility
settings.change_visibility = Change Visibility
settings.invalid_visibility = The new visibility is not valid.
settings.change_visibility_notices_1 = This operation <strong>CANNOT</strong> be undone.
Copy link
Member

Choose a reason for hiding this comment

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

Are there really any destructive operations in some cases that cannot be undone?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, all repository stars will be removed when an organization is converted to private. This behavior follows the logic introduced in #11717. Please note that these stars cannot be restored even if the organization is later changed back to public.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be somehow more detailed because otherwise it looks like visibility change is final and visibility cannot be changed anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants