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

Displayed order of topics is inconsistent between repo list and repo page #28936

Closed
wackbyte opened this issue Jan 26, 2024 · 4 comments · Fixed by #28938
Closed

Displayed order of topics is inconsistent between repo list and repo page #28936

wackbyte opened this issue Jan 26, 2024 · 4 comments · Fixed by #28938
Labels
topic/ui Change the appearance of the Gitea UI type/bug

Comments

@wackbyte
Copy link
Contributor

wackbyte commented Jan 26, 2024

Description

Problem

The order of a repository's topics is different when viewed in a repo list versus when viewed on the repo's page itself. See the screenshots below for an example.

Expected behavior

I would expect the ordering to be consistent between the two pages, either by being sorted or by staying in insertion order. Personally, I would prefer them to be sorted (as they already are on the repo page).

Demo

Screenshots

Order while adding:
Entering the topics A, C, and B in that order

Order after adding (on repo page):
List of topics A, B, and C in that order

Order in the repo list on the user profile:
List of topics A, C, and B in that order

(These screenshots are from the reproduction of the issue on a local test instance I built, not from try.gitea.io, but the same issue occurs there.)

Gitea Version

ba24e0b

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

NixOS

Browser Version

Librewolf 121.0.1

@wackbyte wackbyte added topic/ui Change the appearance of the Gitea UI type/bug labels Jan 26, 2024
@wackbyte
Copy link
Contributor Author

wackbyte commented Jan 26, 2024

I believe I've found the root of the issue.

The repo page (view, template) uses FindTopics to get the list of topics, which sorts them by name.

However, the repo list (view, template) uses the Topics field of the Repository struct, which I assume is not sorted.

EDIT: The code that generates the Topics field (syncTopicsInRepository) sorts by the repo count of each topic, not by name. I replaced .Desc("topic.repo_count") with .Asc("topic.name"), and the issue was fixed once I triggered a sync by editing the repo's topics.

@stuzer05
Copy link

Can we fix milestones list sorting as well? It's not alphabetical

@wackbyte
Copy link
Contributor Author

I can look into it

Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants