Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Correctly set the organization num repos#11339

Merged
lafriks merged 9 commits intogo-gitea:masterfrom
zeripath:fix-11194-fix-organization-counts
May 11, 2020
Merged

Correctly set the organization num repos#11339
lafriks merged 9 commits intogo-gitea:masterfrom
zeripath:fix-11194-fix-organization-counts

Conversation

@zeripath
Copy link
Contributor

@zeripath zeripath commented May 8, 2020

Correctly set the organization num repos to the number of
accessible repos for the user

  • In writing the test for this I have noticed that the API for create Org is broken in several places due to the incorrect use of :orgname when it should be :org. This PR therefore contains fixes for these.

Fix #11194
Fix #11331

Signed-off-by: Andrew Thornton [email protected]

Correctly set the organization num repos to the number of
accessible repos for the user

Fix go-gitea#11194

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath added this to the 1.12.0 milestone May 8, 2020
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 8, 2020
zeripath added 4 commits May 8, 2020 17:04
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
@6543
Copy link
Member

6543 commented May 10, 2020

@zeripath can we add a test for OrgRepoNum somewhere?

@zeripath
Copy link
Contributor Author

zeripath commented May 10, 2020

Presumably there is something in models/org_test.go but the tests are totally opaque. There's not really anything appropriate in integrations - we'd literally have to create a declarative test format that would create organizations, teams, repositories, set members etc.


OK I've added the test. I've done it in the declarative style with reusable component tests.

@6543
Copy link
Member

6543 commented May 11, 2020

Organisations disapiear on "My Organizations" if they have no repo
Bildschirmfoto zu 2020-05-11 03-20-43

@zeripath
Copy link
Contributor Author

zeripath commented May 11, 2020

@6543 presumably this is going to need a LEFT when joining the repository table.

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

🎉

@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 11, 2020
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

have to look to all functions

@codecov-io
Copy link

Codecov Report

Merging #11339 into master will increase coverage by 0.09%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11339      +/-   ##
==========================================
+ Coverage   43.84%   43.93%   +0.09%     
==========================================
  Files         613      613              
  Lines       87229    87236       +7     
==========================================
+ Hits        38245    38328      +83     
+ Misses      44262    44177      -85     
- Partials     4722     4731       +9     
Impacted Files Coverage Δ
models/oauth2.go 34.04% <ø> (ø)
modules/setting/setting.go 45.53% <50.00%> (ø)
modules/markup/markdown/goldmark.go 51.92% <86.36%> (+0.36%) ⬆️
models/user.go 51.04% <92.30%> (+1.37%) ⬆️
modules/lfs/server.go 43.01% <92.30%> (+2.65%) ⬆️
modules/markup/sanitizer.go 93.47% <100.00%> (ø)
routers/api/v1/api.go 77.68% <100.00%> (+0.79%) ⬆️
routers/api/v1/repo/commits.go 77.95% <100.00%> (-2.81%) ⬇️
modules/indexer/stats/db.go 40.62% <0.00%> (-18.75%) ⬇️
modules/indexer/stats/queue.go 62.50% <0.00%> (-18.75%) ⬇️
... and 17 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 45968b9...0af8b35. Read the comment docs.

@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 11, 2020
@lafriks lafriks merged commit c42c31a into go-gitea:master May 11, 2020
@zeripath zeripath deleted the fix-11194-fix-organization-counts branch May 11, 2020 22:05
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Correctly set the organization num repos

Correctly set the organization num repos to the number of
accessible repos for the user

Fix go-gitea#11194

Signed-off-by: Andrew Thornton <[email protected]>

* as per @lunny

Signed-off-by: Andrew Thornton <[email protected]>

* attempt to fix mssql

Signed-off-by: Andrew Thornton <[email protected]>

* Update models/user.go

* Explicit columns

Signed-off-by: Andrew Thornton <[email protected]>

* Add test and fix 0 counted orgs

Signed-off-by: Andrew Thornton <[email protected]>

* remove orgname from api

Signed-off-by: Andrew Thornton <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Api] /orgs/{:orgname}/repos POST endpoint is broken Wrong repository count under dashboard organizations

6 participants