-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add feature flags to the config for Wiki and Issues #7032
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2e43a6a
Implement ENABLE_WIKI config option
jpicht 7d753f9
Implement ENABLE_ISSUES config option
jpicht f14272e
Clean up the repo settings page, if both issues and wiki are disabled
jpicht 033d7e1
remove unneccessary changes
jpicht 061316c
set EnableIssues = true for TestUpdateIssueLabel_Clear
jpicht d91679e
Revert "set EnableIssues = true for TestUpdateIssueLabel_Clear"
jpicht 161500b
Actually set default values for Service.EnableWiki and Service.Enable…
jpicht fe8ae36
Fix the repository options page not displaying pull request options
jpicht c8d84df
move config options Service.EnableWiki, Server.EnableWiki to Repository
jpicht 3647ab6
Fix ".Repository" in templates maps to different type on different pages
jpicht File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -454,7 +454,7 @@ func mustAllowPulls(ctx *context.APIContext) { | |
} | ||
|
||
func mustEnableIssuesOrPulls(ctx *context.APIContext) { | ||
if !ctx.Repo.CanRead(models.UnitTypeIssues) && | ||
if (!setting.Repository.EnableIssues || !ctx.Repo.CanRead(models.UnitTypeIssues)) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So even the repository created some issues, this will still hide them when |
||
!(ctx.Repo.Repository.CanEnablePulls() && ctx.Repo.CanRead(models.UnitTypePullRequests)) { | ||
if ctx.Repo.Repository.CanEnablePulls() && log.IsTrace() { | ||
if ctx.IsSigned { | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be possible to do these changes without changing how unit rights are saved to DB? so that if you later enable enable issues back you would not have to go through all repo teams to enable issues back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really think this is will happen.
Example: We have a company wiki, and an issue tracker. All we do need gitea for is for managing git repositories.
Enabling wiki and issue functions will - very probably - not happen in this use case.
I also don't see a different use case, where you would want to globally disable the Wiki / Issue functions, do you?
DefaultRepoUnits also does not contain UnitTypeIssues (as by @lunny's request #7032 (comment)). So that even removing that line will not change the behavior.
I can provide a small bash+curl script to enable the wiki and/or issues via the API for inclusion in the documentation, so a user could easily work around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is what if I already have existing repository and now I disable issues globally, units for existing repositories will be added so there is not really much point in skiping this for new repos as you will have to check anyway later not only if unit is enabled but also new setting. And if for whaterver reason I later want to enable it back it would be better that user would not have to run scripts to fix db to have working instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it seems this PR is doing two things at the same time
Of course in the second case, it would be confusing to still have the settings for enabling it, but there is really no point of affecting the defaults (as @lafriks point out). If only the first case is wanted, there should not be necessary with any changes in routers, as the wiki/issues is anyhow disabled. For a fresh installation I don't think it matter, but the question is how it shall behave for an existing installation if issues/wikis are globally disabled. Either issues/wikis are disabled for existing repos even if they was enabled before the ini setting was changed. Other alternative is to only allow disable issues/wiki for a repo but not enable it. This would correspond to how FORCE_PRIVATE option is working.