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

Rename ctx.Form() to ctx.FormString() and move code into own file #16571

Merged
merged 21 commits into from Aug 11, 2021

Conversation

6543
Copy link
Member

@6543 6543 commented Jul 29, 2021

Followup from #16562 prepare for #16567

  • Rename ctx.Form() to ctx.FormString()
  • Reimplement FormX func to need less code and cpu cycles
  • Move code into own file

@6543 6543 added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Jul 29, 2021
@6543 6543 added this to the 1.16.0 milestone Jul 29, 2021
modules/context/form.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 29, 2021
routers/web/user/auth_openid.go Outdated Show resolved Hide resolved
@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 Jul 29, 2021
@zeripath
Copy link
Contributor

I don't understand the reasoning behind renaming form to formstring.

It appears to make it inconsistent with the way we use Query and with ini.

Is the intention that form will return the form in the future?

@6543
Copy link
Member Author

6543 commented Jul 29, 2021

@zeripath the problem is that ctx.Req.Form != ctx.Form at the moment ... a name is colliding :/
-> this is more of a code readability problem - the code will just work fine without rename

to the form thing ... it's golang specific - i personaly also prevere to use the term query ... but net/http do differ between GET and POST, ... requests - Query only apply to get where Form do the same and apply to all request types

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2021

Codecov Report

Merging #16571 (03b6dea) into main (d9ef43a) will increase coverage by 0.01%.
The diff coverage is 53.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16571      +/-   ##
==========================================
+ Coverage   45.38%   45.39%   +0.01%     
==========================================
  Files         757      757              
  Lines       85194    85092     -102     
==========================================
- Hits        38664    38630      -34     
+ Misses      40273    40205      -68     
  Partials     6257     6257              
Impacted Files Coverage Δ
modules/context/context.go 59.55% <ø> (-1.36%) ⬇️
modules/context/repo.go 52.99% <0.00%> (ø)
routers/api/v1/admin/adopt.go 0.00% <0.00%> (ø)
routers/api/v1/notify/user.go 11.62% <0.00%> (ø)
routers/api/v1/repo/key.go 17.77% <0.00%> (ø)
routers/api/v1/repo/release_attachment.go 0.00% <0.00%> (ø)
routers/api/v1/repo/topic.go 47.47% <0.00%> (ø)
routers/web/admin/admin.go 11.41% <0.00%> (ø)
routers/web/admin/emails.go 0.00% <0.00%> (ø)
routers/web/admin/repos.go 0.00% <0.00%> (ø)
... and 63 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 d9ef43a...03b6dea. Read the comment docs.

modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
modules/context/form.go Outdated Show resolved Hide resolved
@6543
Copy link
Member Author

6543 commented Aug 4, 2021

@zeripath can you go fmt for me please?

@6543 6543 requested a review from zeripath August 5, 2021 09:15
@6543 6543 changed the title Rename ctx.Form() to ctx.FormString() and move code into own file WIP: Rename ctx.Form() to ctx.FormString() and move code into own file Aug 8, 2021
@6543 6543 changed the title WIP: Rename ctx.Form() to ctx.FormString() and move code into own file Rename ctx.Form() to ctx.FormString() and move code into own file Aug 10, 2021
@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 Aug 10, 2021
@6543
Copy link
Member Author

6543 commented Aug 11, 2021

@zeripath I'll merge this for now, if we like to go a interface way as you proposed ... I'm happy to review your pull etc. For now I think this is god to go and we can move things forward ... (It's already cleaner this way & rm useless code)

@6543 6543 merged commit c4d70a0 into go-gitea:main Aug 11, 2021
@6543 6543 deleted the followup-from-16562-prepare-for-16567 branch August 11, 2021 00:31
@lafriks lafriks added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Aug 11, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
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. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants