Skip to content
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

Enable packages by default again #19746

Merged
merged 3 commits into from
May 20, 2022
Merged

Conversation

delvh
Copy link
Member

@delvh delvh commented May 18, 2022

#19323 used the wrong default value to check if packages are globally disabled.
This means that unexpectedly, users that did not set [packages] ENABLE = true in their app.ini would simply not be able to use packages.

@delvh delvh self-assigned this May 18, 2022
@delvh delvh requested review from lunny and KN4CK3R May 18, 2022 14:24
@delvh delvh added the issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself label May 18, 2022
@delvh delvh added this to the 1.17.0 milestone May 18, 2022
@KN4CK3R
Copy link
Member

KN4CK3R commented May 18, 2022

It may be better to remove that code and add something like this outside that method:

diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 5e317b39e..553445658 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1024,6 +1024,10 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
 
        newPackages()
 
+       if !Packages.Enabled {
+               Repository.DisabledRepoUnits = append(Repository.DisabledRepoUnits, "repo.packages")
+       }
+
        if err = Cfg.Section("ui").MapTo(&UI); err != nil {
                log.Fatal("Failed to map UI settings: %v", err)
        } else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil {

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 18, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #19746 (b1f2179) into main (af4caca) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main   #19746      +/-   ##
==========================================
- Coverage   47.38%   47.37%   -0.02%     
==========================================
  Files         958      958              
  Lines      133601   133603       +2     
==========================================
- Hits        63313    63296      -17     
- Misses      62627    62641      +14     
- Partials     7661     7666       +5     
Impacted Files Coverage Δ
modules/setting/repository.go 55.71% <0.00%> (ø)
modules/indexer/stats/indexer.go 51.06% <0.00%> (-6.39%) ⬇️
modules/git/repo_base_nogogit.go 70.58% <0.00%> (-3.93%) ⬇️
modules/git/utils.go 66.29% <0.00%> (-3.38%) ⬇️
modules/queue/queue_channel.go 83.33% <0.00%> (-1.86%) ⬇️
modules/queue/queue_disk_channel.go 60.83% <0.00%> (-1.25%) ⬇️
modules/queue/workerpool.go 54.66% <0.00%> (-0.78%) ⬇️
models/issue_comment.go 51.60% <0.00%> (-0.67%) ⬇️
models/repo_list.go 82.40% <0.00%> (-0.47%) ⬇️
modules/queue/queue_bytefifo.go 53.06% <0.00%> (-0.37%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af4caca...b1f2179. Read the comment docs.

@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 May 18, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 19, 2022
@6543
Copy link
Member

6543 commented May 19, 2022

It may be better to remove that code and add something like this outside that method:

diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 5e317b39e..553445658 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1024,6 +1024,10 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
 
        newPackages()
 
+       if !Packages.Enabled {
+               Repository.DisabledRepoUnits = append(Repository.DisabledRepoUnits, "repo.packages")
+       }
+
        if err = Cfg.Section("ui").MapTo(&UI); err != nil {
                log.Fatal("Failed to map UI settings: %v", err)
        } else if err = Cfg.Section("markdown").MapTo(&Markdown); err != nil {

unrelated but I think we should have a look at this too ...

@KN4CK3R
Copy link
Member

KN4CK3R commented May 19, 2022

I don't think it's unrelated because with the current change you have two sources of truth for the "are packages enabled" question. With my proposed change there is only one and the problem would not have occured in the first place.

@6543
Copy link
Member

6543 commented May 19, 2022

same for Projects(KanBan)...

@KN4CK3R
Copy link
Member

KN4CK3R commented May 19, 2022

What do you mean? I do not see project related code in the repository code.

@lunny
Copy link
Member

lunny commented May 19, 2022

loadFromConf

Yes, this maybe better because then there is only one place to read package configuration.

@6543
Copy link
Member

6543 commented May 19, 2022

ok let's merge this and we can talk about refactoring next ...

@6543 6543 merged commit 3b359b1 into go-gitea:main May 20, 2022
@delvh delvh deleted the enable-packages-by-default branch May 20, 2022 09:26
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 20, 2022
* giteaofficial/main:
  Move org functions (go-gitea#19753)
  [doctor] pq: syntax error at or near "." quote user table name (go-gitea#19765)
  [doctor] update the help with fix capabilities (go-gitea#19762)
  Remove fomantic progress module (go-gitea#19760)
  Make Ctrl+Enter (quick submit) work for issue comment and wiki editor (go-gitea#19729)
  Enable packages by default again (as described by docs) (go-gitea#19746)
  Replace blue button and label classes with primary (go-gitea#19763)
  Fix org package owner permissions (go-gitea#19742)
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants