Six admin user table columns sort backwards under their own caret
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Describe the bug
Six sortable columns in the admin user table render backwards relative to the caret they light.
`frontend/src/app/dashboard/component/admin/user/admin-user.component.ts` — `sortByName`, `sortByEmail`, `sortByAffiliation`, `sortByJoiningReason`, `sortByComment` and `sortByRole` all compare with reversed operands, e.g. `(b.name || "").localeCompare(a.name || "")`.
ng-zorro uses an `NzTableSortFn`'s result **as-is** for `ascend` and negates it for `descend` (`ng-zorro-antd-table.mjs`, around line 822), and the `` click handler cycles `getNextSortDirection`. Every one of these six headers declares `nzSortDirections="['ascend','descend']"` — with no `null` member — so **the first click is always `ascend`**. A reversed comparator therefore renders Z→A under a lit up-caret.
Two corroborations inside the same file: the tie-breaker in all six is the contract-correct ascending `a.uid - b.uid`, and `sortByAccountCreation` (line 268, same header shape) already uses ascending `(a…) - (b…)`.
An identical defect was just fixed in `user-quota.component.ts`'s `sortBySize` (#7806), with the same signature — caret assertions passing while the rows came out reversed.
Note the existing spec was **cementing** this: its "column sort comparators" block asserted things like `sortByName(Alice, Bob) > 0`.
### How to reproduce?
Open the admin user table and click any of the six headers once. The up-caret lights and the column reads Z→A.
### Version/Branch
main
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [x] Other
Contributor guide
Assessment
This issue has not been assessed yet.