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

Refactor issue label selection #31497

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jun 26, 2024

Follow #26460, rename the variable names to follow Golang standard, and use container.Set[string] directly to simplify the code.

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 26, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 26, 2024
@wxiaoguang wxiaoguang added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Jun 26, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jun 26, 2024
@wxiaoguang wxiaoguang changed the title Refacotor issue label selection Refactor issue label selection Jun 26, 2024
@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 Jun 26, 2024
labelQuerySliceStrings[i] = strconv.FormatInt(x, 10)
}
labelQuerySliceStrings := labelQueryParams.Values()
slices.Sort(labelQuerySliceStrings) // the sort is still needed because the underlying map of Set doesn't guarantee order
Copy link
Contributor

Choose a reason for hiding this comment

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

Little warning: probably acceptable in this case but you're sorting strings now so it will output something like 1,10,2 instead of 1,2,10.

Copy link
Contributor Author

@wxiaoguang wxiaoguang Jun 26, 2024

Choose a reason for hiding this comment

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

Don't really see the necessity.

They are IDs and are totally transparent to other modules, the only thing we need to do is to make them ordered, so string comparing or number comparing doesn't matter.

Think about another case, if we have a lot of UUIDs as IDs, we could also just sort them, and we do not really care about why A<B or A>B

@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 Jun 26, 2024
@wxiaoguang wxiaoguang enabled auto-merge (squash) June 26, 2024 23:13
@wxiaoguang wxiaoguang merged commit 00fc29a into go-gitea:main Jun 26, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 26, 2024
@wxiaoguang wxiaoguang deleted the refactor-issue-label branch June 26, 2024 23:52
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 27, 2024
* giteaofficial/main:
  Refactor issue label selection (go-gitea#31497)
  Refactor dropzone (go-gitea#31482)
  [skip ci] Updated translations via Crowdin
  Optimization of labels handling in issue_search (go-gitea#26460)
  use correct l10n string (go-gitea#31487)
  Fix overflow menu flickering on mobile (go-gitea#31484)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/M Denotes a PR that changes 30-99 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants