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

Remove deprecated query condition in ListReleases #28339

Merged
merged 2 commits into from Dec 5, 2023

Conversation

lng2020
Copy link
Member

@lng2020 lng2020 commented Dec 4, 2023

close #24057
call stack:

if listOptions.PageSize == 0 && ctx.FormInt("per_page") != 0 {

func GetListOptions(ctx *context.APIContext) db.ListOptions {
return db.ListOptions{
Page: ctx.FormInt("page"),
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
}
}

func ToCorrectPageSize(size int) int {
if size <= 0 {
size = setting.API.DefaultPagingNum
} else if size > setting.API.MaxResponseItems {
size = setting.API.MaxResponseItems
}
return size
}

⚠️ Breaking ⚠️ (though it's not caused by this PR)

Do not use per_page to specify pagination; use limit instead

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 4, 2023
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 4, 2023
@github-actions github-actions bot added the modifies/api This PR adds API routes or modifies them label Dec 4, 2023
@lunny lunny added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Dec 4, 2023
@lunny lunny added this to the 1.22.0 milestone Dec 4, 2023
@lng2020

This comment was marked as outdated.

@lunny
Copy link
Member

lunny commented Dec 4, 2023

Maybe that PR should not be considered as breaking because it kept the compatible as before.

@lng2020
Copy link
Member Author

lng2020 commented Dec 4, 2023

After doing some digging, I found this one: https://github.com/go-gitea/gitea/pull/16175/files#diff-91fd5bc00cb24aac69be1c0504b0765185c9cf69dfd561e50b1de6c808228ca2L103 is accidentally caused the per_page useless, which cause the breaking. Before that, although per_page is deprecated, the user can still use this condition.
So there are two options:

  1. remove listOptions.PageSize == 0 to let per_page work again, although it's been deprecated and useless for a long time.
  2. Remove the per_page condition and label it breaking, although it's not the real breaking reason. Just as this PR does.

@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 Dec 5, 2023
@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 Dec 5, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 5, 2023
@lunny lunny enabled auto-merge (squash) December 5, 2023 07:14
@lunny lunny merged commit 0aab2d3 into go-gitea:main Dec 5, 2023
25 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Dec 5, 2023
@lng2020 lng2020 deleted the remove-deprecated-code branch December 5, 2023 07:42
zjjhot added a commit to zjjhot/gitea that referenced this pull request Dec 6, 2023
* giteaofficial/main:
  Fix the runs will not be displayed bug when the main branch have no workflows but other branches have (go-gitea#28359)
  [skip ci] Updated translations via Crowdin
  Render PyPi long description as document (go-gitea#28272)
  handle repository.size column being NULL in migration v263 (go-gitea#28336)
  Fix migration panic due to an empty review comment diff (go-gitea#28334)
  Add `HEAD` support for rpm repo files (go-gitea#28309)
  Remove deprecated query condition in ListReleases (go-gitea#28339)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 4, 2024
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. modifies/api This PR adds API routes or modifies them pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error deprecat argment check
4 participants