-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Add a way to opt out of repo code indexing, on a per-repo basis #20418
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
Closed
Closed
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -382,6 +382,7 @@ func SettingsPost(ctx *context.Context) { | |||||||||||||||||
|
|
||||||||||||||||||
| case "advanced": | ||||||||||||||||||
| var repoChanged bool | ||||||||||||||||||
| var codeIndexingChanged bool | ||||||||||||||||||
| var units []repo_model.RepoUnit | ||||||||||||||||||
| var deleteUnitTypes []unit_model.Type | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -394,6 +395,11 @@ func SettingsPost(ctx *context.Context) { | |||||||||||||||||
| repoChanged = true | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if repo.IsCodeIndexingEnabled != form.EnableCodeIndexing { | ||||||||||||||||||
| repo.IsCodeIndexingEnabled = form.EnableCodeIndexing | ||||||||||||||||||
| codeIndexingChanged = true | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
+398
to
+401
Member
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.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| if form.EnableWiki && form.EnableExternalWiki && !unit_model.TypeExternalWiki.UnitGlobalDisabled() { | ||||||||||||||||||
| if !validation.IsValidExternalURL(form.ExternalWikiURL) { | ||||||||||||||||||
| ctx.Flash.Error(ctx.Tr("repo.settings.external_wiki_url_error")) | ||||||||||||||||||
|
|
@@ -515,6 +521,13 @@ func SettingsPost(ctx *context.Context) { | |||||||||||||||||
| ctx.ServerError("UpdateRepository", err) | ||||||||||||||||||
| return | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if codeIndexingChanged { | ||||||||||||||||||
| // Whether we enabled or disabled indexing, trigger a repo indexer | ||||||||||||||||||
| // update. If we enabled, this will reindex the repo; if we disabled, it | ||||||||||||||||||
| // will delete the repo from the index. | ||||||||||||||||||
| code.UpdateRepoIndexer(ctx.Repo.Repository) | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| log.Trace("Repository advanced settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
This file contains hidden or 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 hidden or 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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -420,6 +420,16 @@ | |||||||||
| </div> | ||||||||||
| </div> | ||||||||||
|
|
||||||||||
| {{if .CodeIndexerEnabled}} | ||||||||||
| <div class="inline field"> | ||||||||||
| <label>{{.locale.Tr "repo.settings.code_search_indexing"}}</label> | ||||||||||
| <div class="ui checkbox"> | ||||||||||
| <input class="enable-system" name="enable_code_indexing" type="checkbox" {{if .Repository.IsCodeIndexingEnabled}}checked{{end}}> | ||||||||||
| <label>{{.locale.Tr "repo.settings.code_search_indexing_desc"}}</label> | ||||||||||
|
Comment on lines
+427
to
+428
Member
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.
Suggested change
|
||||||||||
| </div> | ||||||||||
| </div> | ||||||||||
| {{end}} | ||||||||||
|
|
||||||||||
| {{if not .IsMirror}} | ||||||||||
| <div class="ui divider"></div> | ||||||||||
| {{$pullRequestEnabled := .Repository.UnitEnabled $.UnitTypePullRequests}} | ||||||||||
|
|
@@ -600,10 +610,11 @@ | |||||||||
| </form> | ||||||||||
|
|
||||||||||
| <div class="ui divider"></div> | ||||||||||
|
|
||||||||||
| <form class="ui form" method="post"> | ||||||||||
| {{.CsrfTokenHtml}} | ||||||||||
| <input type="hidden" name="action" value="admin_index"> | ||||||||||
| {{if .CodeIndexerEnabled}} | ||||||||||
| {{if and .CodeIndexerEnabled .Repository.IsCodeIndexingEnabled}} | ||||||||||
| <h4 class="ui header">{{.locale.Tr "repo.settings.admin_code_indexer"}}</h4> | ||||||||||
| <div class="inline fields"> | ||||||||||
| <label>{{.locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label> | ||||||||||
|
|
||||||||||
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.
This require a migration, it should be similar to
models/migrations/v219.go, copy paste this whole struct(fixup the imports) and run Sync2 on it.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.
Will do!
May take a day or two until I have some cycles to spend on updating this PR, but I'll get there eventually.