Merge pull request 'fix(users): show recently created accounts first' (#44) from fix/users-show-newest-first into main
Heimdall Gitea / Build and tests (push) Failing after 1m46s
Heimdall Gitea / Publish versioned release (push) Skipped

This commit was merged in pull request #44.
This commit is contained in:
arnaud.dartois committed 2026-10-22 19:13:41 +02:00
commit efde3f23b5
1 file changed
+5 -1
@@ -21,7 +21,11 @@ public class UserRepository : IUserRepository
public async Task<PagedResult<UserResponse>> GetPagedAsync(int page, int pageSize, CancellationToken ct)
{
var query = _db.Users.AsNoTracking().OrderBy(u => u.DisplayName);
// Keep newly created accounts visible on the first page immediately after
// creation, even when the installation has more users than one page.
var query = _db.Users.AsNoTracking()
.OrderByDescending(u => u.CreatedAt)
.ThenBy(u => u.Id);
var total = await query.CountAsync(ct).ConfigureAwait(false);
var users = await query
.Skip((page - 1) * pageSize)