Sort by name on logged in page

This commit is contained in:
Jonathon Leight
2026-06-21 22:14:46 -04:00
parent aeefdd707b
commit 584a2ebb6f
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -346,7 +346,7 @@ func (s *Store) ListOrgsForUser(ctx context.Context, userID int64) ([]OrgMembers
rows, err := s.pool.Query(ctx, `
SELECT o.id, o.slug, o.name, o.description, o.created_by, o.created_at, m.role
FROM org_members m JOIN organizations o ON o.id = m.org_id
WHERE m.user_id = $1 ORDER BY o.name`, userID)
WHERE m.user_id = $1 ORDER BY lower(o.name), o.id`, userID)
if err != nil {
return nil, fmt.Errorf("list orgs: %w", err)
}
+2 -2
View File
@@ -126,14 +126,14 @@ func scanRepeater(row pgx.Row) (*Repeater, error) {
}
// ListRepeatersForUser returns repeaters the user owns or has been granted
// access to, owned ones first.
// access to, owned ones first and then by name within each group.
func (s *Store) ListRepeatersForUser(ctx context.Context, userID int64) ([]*Repeater, error) {
// Dashboard listing: repeaters the user owns or has a direct share on. Org-
// contributed repeaters are reached from the org page, not listed here.
rows, err := s.pool.Query(ctx, repeaterSelect+`
WHERE r.owner_id = $1
OR r.id IN (SELECT repeater_id FROM repeater_shares WHERE user_id = $1)
ORDER BY shared, r.created_at`, userID)
ORDER BY shared, lower(r.name), r.id`, userID)
if err != nil {
return nil, fmt.Errorf("list repeaters: %w", err)
}