Group list > "updated" filter list not in order

Problem

On the group list page, when the "Updated" filter is applied, the content doesn't order according to date updated:

image

Though originally reported on the project list page, that seems to be resolved. However, the problem was re-verified on the group list page Oct 2023. Additional details in the original issue description section.

Root cause

When you change the sort order and then expand a group, the projects are loaded for that group but the sort order is not preserved. Example.

image

When clicking on the Remote Development group, projects are ordered by last activity.

image

So the sort dropdown setting is not remembered when using the 'expand' button.

Proposal

Each expansion is an separate call to children.json that only occurs when clicked. The page isn't loading in all subgroups/projects in the initial load (quite rightly), it only calls once for the direct descendants.

The calls are actually all the same controller under the hood except the expansion actions have an additional parent_id filter, e.g. children.json?parent_id=14079342. All that would need to happen here is the addition of the sort filter, e.g. children.json?parent_id=14079342&sort=stars_desc.

On this line, we pass options, including sorting, to the code that retrieves the subgroups and projects of a group. But these options (group_descendants_params) do not have the sort order because we modify params after we defined group_descendants_params.

Original issue description With this new feature that adds the updated time to projects, it looks like a bug has been exposed. In the following screenshot, I have my projects sorted by Last Updated. You'll notice that the order of the projects go from updated 1 month ago, to 6 months, and then to 3 months.

Screen_Shot_2017-01-24_at_12.01.30_PM

It also looks like there is a bug with the Last Updated timestamp not being accurate

See:

image

vs. (project pushed to)

image

and. (issue updated/created)

image

Implementation guide

Frontend

  1. Pass sortBy in app/assets/javascripts/groups/components/app.vue#L183
  2. Update specs in spec/frontend/groups/components/app_spec.js

Backend

Needs refinement, sounds like there may need to be a backend change to allow nested groups to be sorted correctly. See #17017 (comment 1780851396)

Edited by Peter Hegman