"My repositories" sorting#1266

Closed
opened 2023-04-14 09:06:40 +02:00 by KaKi87 · 20 comments

# Describe your matter briefly

Items in "My Repositories" are weirdly sorted, so I'd like to suggest sorting these by update date or name by default and allow the user change it as a setting.

Thanks


## # Describe your matter briefly Items in "My Repositories" are weirdly sorted, so I'd like to suggest sorting these by update date or name by default and allow the user change it as a setting. Thanks --- - [x] I carefully read the [contribution guidelines](https://codeberg.org/gitnex/GitNex/wiki/Contributing).
Owner

This should be an upstream, because I don't see any parameter to sort the repositories. Currently the API provide results and GitNex just render it as is.

API: https://codeberg.org/api/swagger#/user/userCurrentListRepos

This should be an upstream, because I don't see any parameter to sort the repositories. Currently the API provide results and GitNex just render it as is. API: https://codeberg.org/api/swagger#/user/userCurrentListRepos
Author

How about getting the full list and sorting locally ?

How about getting the full list and sorting locally ?
Contributor

This is incompatible with pagination (and we won't fetch the full list and break pagination).

This is incompatible with pagination (and we won't fetch the full list and break pagination).

how is it incompat with pagination in this case? my own "My repositories" list has no pagination, its just a long list.

how is it incompat with pagination in this case? my own "My repositories" list has no pagination, its just a long list.
Owner

From issue #1274:

well, it's definitely possible, as that's what the web interface does. maybe it implements it locally

Web interface directly work with the database calls, while GitNex rely on API calls, it has no direct access to database like web interface.

how is it incompat with pagination in this case? my own "My repositories" list has no pagination, its just a long list.

By default, each implemented API call has pagination (where needed). What it means is that the local sort becomes useless when pagination is called for next set of data.

From issue #1274: > well, it's definitely possible, as that's what the web interface does. maybe it implements it locally Web interface directly work with the database calls, while GitNex rely on API calls, it has no direct access to database like web interface. > how is it incompat with pagination in this case? my own "My repositories" list has no pagination, its just a long list. By default, each implemented API call has pagination (where needed). What it means is that the local sort becomes useless when pagination is called for next set of data.
Owner

Beside that, adding sort to the API call is the way forward and easier to follow.

Beside that, adding sort to the API call is the way forward and easier to follow.
related: https://codeberg.org/forgejo/forgejo/issues/4173
Owner

Thank you @martianh for reporting it upstream.

Thank you @martianh for reporting it upstream.

No problems! I actually started hacking on a small emacs client for forgejo recently, and was confused by the sorting of results. i'm used to APIs that have server-side sorting.

but I wonder, there must be another way to do it, as the web UI allows for a full range of sorting options, which don't break pagination. it may just be a case of lacking client app documentation. (i also don't know how to discover maximum values for "limit" params or similar, do you?)

i think forgejo peeps are very busy, so not sure if they'll respond as they marked it as a not important issue.

No problems! I actually started hacking on a small emacs client for forgejo recently, and was confused by the sorting of results. i'm used to APIs that have server-side sorting. but I wonder, there must be another way to do it, as the web UI allows for a full range of sorting options, which don't break pagination. it may just be a case of lacking client app documentation. (i also don't know how to discover maximum values for "limit" params or similar, do you?) i think forgejo peeps are very busy, so not sure if they'll respond as they marked it as a not important issue.

but I wonder, there must be another way to do it, as the web UI allows for a full range of sorting options, which don't break pagination.

I think your question was already answered here.

> but I wonder, there must be another way to do it, as the web UI allows for a full range of sorting options, which don't break pagination. I think your question was already answered [here](https://codeberg.org/gitnex/GitNex/issues/1266#issuecomment-951093).

FYI, i encountered a friendly forgejo dev on fedi, and asked about sort params for issues.

they kindly agreed to take a look, and hey presto: forgejo/forgejo#7211.

(nb: API sort params for issues, not repos, but still good news.)

FYI, i encountered a friendly forgejo dev on fedi, and asked about sort params for issues. they kindly agreed to take a look, and hey presto: https://codeberg.org/forgejo/forgejo/pulls/7211. (nb: API sort params for issues, not repos, but still good news.)

the above PR has been approved. maybe gitnex could also request API sorting for repo listings too? if you follow the issue template (unlike me) and say you're from gitnex, you'll likely get a response.

the above PR has been approved. maybe gitnex could also request API sorting for repo listings too? if you follow the issue template (unlike me) and say you're from gitnex, you'll likely get a response.
Owner

Thanks for the update.

I normally do, but I have to also manage my time with other things and don't have much time to check other projects.
Last time some of the GitNex maintainers worked on Gitea also, so it was fast to implement a feature or fix. Now is a bit different because they left GitNex and also the split of Gitea and Forgejo.

But you still can open issues there and tag me if you feel to. At least this we can remind them that the issue is there and open.

Thanks for the update. I normally do, but I have to also manage my time with other things and don't have much time to check other projects. Last time some of the GitNex maintainers worked on Gitea also, so it was fast to implement a feature or fix. Now is a bit different because they left GitNex and also the split of Gitea and Forgejo. But you still can open issues there and tag me if you feel to. At least this we can remind them that the issue is there and open.

@mmarif wrote in #1266 (comment):

But you still can open issues there and tag me if you feel to. At least this we can remind them that the issue is there and open.

No need to, forgejo/forgejo#7256

@mmarif wrote in https://codeberg.org/gitnex/GitNex/issues/1266#issuecomment-3080640: > But you still can open issues there and tag me if you feel to. At least this we can remind them that the issue is there and open. No need to, forgejo/forgejo#7256
Owner

Thank you @Gusted , that was super fast.

Not related, but I thought if someone want to work on this one, its there for sometime and only affect Codeberg and MySQL related instances I think.
forgejo/forgejo#1998

Thank you @Gusted , that was super fast. Not related, but I thought if someone want to work on this one, its there for sometime and only affect Codeberg and MySQL related instances I think. https://codeberg.org/forgejo/forgejo/issues/1998

@mmarif wrote in #1266 (comment):

Not related, but I thought if someone want to work on this one, its there for sometime and only affect Codeberg and MySQL related instances I think.
forgejo/forgejo#1998

How does gitnex use this? I'm kinda scared to fix this query as returning all issues accessible to the user seems a bit too much to be returning over the internet ah its limited, does Gitnex require all the issues to be returned?

@mmarif wrote in https://codeberg.org/gitnex/GitNex/issues/1266#issuecomment-3084354: > Not related, but I thought if someone want to work on this one, its there for sometime and only affect Codeberg and MySQL related instances I think. > forgejo/forgejo#1998 How does gitnex use this? ~~I'm kinda scared to fix this query as returning **all issues accessible to the user** seems a bit too much to be returning over the internet~~ ah its limited, does Gitnex require all the issues to be returned?

just an update, this is in main Foregejo now, v 11 is released and running. So GitNex could implement a fix for this now.

just an update, this is in main Foregejo now, v 11 is released and running. So GitNex could implement a fix for this now.
Owner

@martianh Thanks.

I think there’s been a slight miscommunication here.

There are two endpoints:

  • /api/v1/user/repos – Sorting has already been added to this one. It’s a generic API that lists all repositories a user has access to. In the app, this corresponds to the "Repositories" section.

  • /api/v1/user/{username}/repos – This is the endpoint referenced in this issue. It represents the "My Repositories" section in the app and only includes repositories created under the user's own username.

The point is that sorting has currently been added to an endpoint that powers a different screen in the app. While that's still useful, I suggest we also add sorting to the /api/v1/user/{username}/repos endpoint.

Apologies for the confusion earlier—my previous message referenced the wrong endpoint. That was an oversight on my part.
#1266 (comment)

The implementation is already in place, and I hope it can be easily added to the other endpoint in a point release for v11, if the Forgejo team is open to it.

cc @Gusted.

@martianh Thanks. I think there’s been a slight miscommunication here. There are two endpoints: - `/api/v1/user/repos` – Sorting has already been added to this one. It’s a generic API that lists all repositories a user has access to. In the app, this corresponds to the "Repositories" section. - `/api/v1/user/{username}/repos` – This is the endpoint referenced in this issue. It represents the "My Repositories" section in the app and only includes repositories created under the user's own username. The point is that sorting has currently been added to an endpoint that powers a different screen in the app. While that's still useful, I suggest we also add sorting to the `/api/v1/user/{username}/repos` endpoint. Apologies for the confusion earlier—my previous message referenced the wrong endpoint. That was an oversight on my part. https://codeberg.org/gitnex/GitNex/issues/1266#issuecomment-874154 The implementation is already in place, and I hope it can be easily added to the other endpoint in a point release for v11, if the Forgejo team is open to it. cc @Gusted.

thanks for clarifying. for basic usage j dont much mind which one i use. currently my Repositories view is sorted alphabetically (server default), but it has no UI to choose sorting. i would expect a default like last updated and a way for the user to select sorting. is that possible? (i think im on latest release also)

thanks for clarifying. for basic usage j dont much mind which one i use. currently my Repositories view is sorted alphabetically (server default), but it has no UI to choose sorting. i would expect a default like last updated and a way for the user to select sorting. is that possible? (i think im on latest release also)
Owner

Sorting is just added to that endpoint. GitNex does not have this option yet. Hopefully the next release can have it for Repositories and My Repositories (if it was implemented before the release).

Sorting is just added to that endpoint. GitNex does not have this option yet. Hopefully the next release can have it for Repositories and My Repositories (if it was implemented before the release).
mmarif added this to the 9.0.0 milestone 2025-06-18 10:22:23 +02:00
mmarif self-assigned this 2025-06-18 10:22:25 +02:00
jasewolf referenced this issue from a commit 2025-07-16 05:53:12 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
6 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gitnex/GitNex#1266
No description provided.