Skip to content

feat: Add sorting by exclusive labels (issue priority) #33206

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

Merged
merged 68 commits into from
Apr 10, 2025

Conversation

telackey
Copy link
Contributor

@telackey telackey commented Jan 10, 2025

Fix #2616

This PR adds a new sort option for exclusive labels.

While this has been looked at before (see the first comment below for a list), the goal of this particular approach was to do it in the most lightweight and flexible way possible, by making use of the existing exclusive label system. No changes are made to the Issue model.

For exclusive labels, a new property is exposed called "order", while in the UI options are populated automatically in the Sort column (see screenshot below) for each exclusive label scope.

This doesn't impose any particular scheme for prioritization, labeling, etc.; that's all up to the user.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 10, 2025
@github-actions github-actions bot added modifies/translation modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Jan 10, 2025
@pull-request-size pull-request-size bot added size/M and removed size/L labels Jan 10, 2025
@pull-request-size pull-request-size bot added size/L and removed size/M labels Jan 10, 2025
@telackey telackey changed the title DRAFT: Add sorting of exclusive labels. DRAFT: Add sorting by exclusive labels. Jan 10, 2025
@telackey telackey changed the title DRAFT: Add sorting by exclusive labels. DRAFT: Add sorting by exclusive label. Jan 10, 2025
@wxiaoguang
Copy link
Contributor

There are different PRs for this problem and they conflict with each other (and the problem is pending for long time)

@dboreham
Copy link

Screen shot showing the feature:

image

@techknowlogick
Copy link
Member

pinging @lafriks as this is likely relevant to your interests

@dboreham
Copy link

Proposed fix for #2616

@telackey telackey marked this pull request as ready for review February 17, 2025 20:11
@telackey telackey changed the title DRAFT: Add sorting by exclusive label. Add sorting by exclusive label (fix for #2616) Feb 17, 2025
@telackey
Copy link
Contributor Author

telackey commented Apr 7, 2025

new screenshots

image
image
image
image

@telackey
Copy link
Contributor Author

telackey commented Apr 8, 2025

How's that look?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 9, 2025

Made some changes in 259f134 (and some following up commits):

  1. Rename some variables and add some comments
  2. Treat exclusive_order=0 as "not set" in "LEFT JOIN"
  3. Fix mismtached ExclusiveOrder type in the migration (it should be int to match the model)
  4. Remove all SearchOptions.IssueIDs because we just need to use "db indexer" directly
  5. Fix the bug that "New Label" didn't get the correct order: add the missing ExclusiveOrder: form.ExclusiveOrder,
  6. Slightly rewrite the "issue list" logic, use "db indexer" directly with the already queried issue IDs or empty keyword.
  7. Use HTMLFormat(%d) for the ExclusiveOrder, no need to "RenderEmoji"
  8. Fix the wrongly changed "access token scope"
  9. Avoid duplicate label queries, reuse the prepared "AllLabels" slice.

@wxiaoguang wxiaoguang changed the title feat: Add sorting by exclusive label. feat: Add sorting by exclusive labels (issue priority) Apr 9, 2025
@wxiaoguang wxiaoguang added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Apr 9, 2025
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

Done from my side

@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 Apr 9, 2025
@wxiaoguang wxiaoguang requested a review from lunny April 9, 2025 02:32
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 10, 2025

@go-gitea/maintainers I think this approach is good enough: there should be no performance regression, and it is flexible enough.

@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 Apr 10, 2025
@wxiaoguang wxiaoguang enabled auto-merge (squash) April 10, 2025 16:53
@wxiaoguang wxiaoguang merged commit fa49cd7 into go-gitea:main Apr 10, 2025
26 checks passed
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 14, 2025
* giteaofficial/main: (27 commits)
  fix github migration error when using multiple tokens (go-gitea#34144)
  Add package version api endpoints (go-gitea#34173)
  Fix incorrect file links (go-gitea#34189)
  Add cache for common package queries (go-gitea#22491)
  Allow admins and org owners to change org member public status (go-gitea#28294)
  Fix span svg layout (go-gitea#34185)
  fix webhook url (go-gitea#34186)
  Optimize overflow-menu (go-gitea#34183)
  Move and rename UpdateRepository (go-gitea#34136)
  Update milestones.tmpl (go-gitea#34184)
  [skip ci] Updated translations via Crowdin
  Refactor Git Attribute & performance optimization (go-gitea#34154)
  [skip ci] Updated translations via Crowdin
  fix(go-gitea#33711): cross-publish docker images to ghcr.io (go-gitea#34148)
  refactor organization menu (go-gitea#33928)
  feat: Add sorting by exclusive labels (issue priority) (go-gitea#33206)
  Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (go-gitea#34137)
  bugfix check for alternate ssh host certificate location (go-gitea#34146)
  Cache GPG keys, emails and users when list commits (go-gitea#34086)
  Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (go-gitea#34152)
  ...
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/frontend modifies/go Pull requests that update Go code modifies/migrations modifies/templates This PR modifies the template files modifies/translation type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prioritize issues
8 participants