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.
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
Keep filter when showing unfiltered results on explore page #27192
Keep filter when showing unfiltered results on explore page #27192
Changes from 1 commit
377105e
b7f9c72
59ca52b
5ece6aa
af85620
0c6b3fa
1346d23
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It needs
QueryEscape
. Otherwise, if you search "C++" or "C#", it breaks the URL.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.
Its better to do this url formation in backend,
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.
It needs #27192 (comment)
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.
but there will be too much if we pass key:value in the template if we have many params. Template will not be human readable. So....
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.
No, the idea is that every link only specifies the param it controls, so only 1 key/value pair per link. The backend then fills the rest and renders a combined URL with all the existing params present on the request URL from
ctx
.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.
I have no objection if the new approach is well designed. Two points in my mind:
$.Link
is not necessary. The URL could be as simple as?k1=v1&k2=v2
SetQueryParams
doesn't seem a good name.SetXxx
seems to be a function which "sets a value to something, has no return value".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 make a proof of concept of this soon.
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.
I think I will name it
ExtendQueryParams
. Or do you have a better idea?At least in JS it is somewhat common, for example a expression
foo = 1
also evaluates to the1
value.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.
I also had some thoughts about this problem, since Gitea has a lot of requirements of maintaining the URL components in the template, maybe something like:
No, it is confusing in this case. In your case
foo
is changed to1
. But in the{{SetQueryParams ctx "only_show_relevant" "0"}}
case, has thectx
been changed? That's a wrong design pattern.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.
I think
ExtendQuery
is a good name, based onURL.Query
name. Not sure if there is any benefit of making itctx.ExtendQuery
I guess it only worsens performance having to "build" this function every time. I think I preferExtendQuery
withctx
passed in as first argument.