Skip to content

feat: sort users and projects by last activity by default#3103

Merged
HarshMN2345 merged 1 commit into
mainfrom
feat/sort-by-accessed-at
Jul 2, 2026
Merged

feat: sort users and projects by last activity by default#3103
HarshMN2345 merged 1 commit into
mainfrom
feat/sort-by-accessed-at

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Users list (/auth) now defaults to orderDesc('accessedAt') — most recently active users appear first
  • Projects list (org page) now defaults to orderDesc('accessedAt') — most recently accessed projects appear first

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR changes the default sort order for the Users list (/auth) and the org-level Projects list from natural ordering (orderDesc('')) to most-recently-active-first (orderDesc('accessedAt')). The change is intentionally gated on a backend deployment (appwrite/appwrite#12645) that exposes the accessedAt attribute as an orderable field.

  • Users page (auth/+page.ts): adds Query.orderDesc('accessedAt') to the users.list queries; users with no login history (null accessedAt) will consistently appear last.
  • Org projects page (organization/+page.ts): same ordering added to listProjects; when a search term is present, Query.search('search', search) is combined with Query.orderDesc('accessedAt') — a pattern not used elsewhere in the codebase that should be explicitly tested once the backend change is live.

Confidence Score: 4/5

Safe to merge once the backend dependency (appwrite#12645) is deployed and the search+ordering combination has been manually verified.

The diff is minimal and the intent is clear. The main uncertainty is whether combining Query.search() or the search param with Query.orderDesc('accessedAt') is supported by the backend — no other page in the codebase uses this pattern, so it hasn't been exercised. If the backend rejects the combination, project and user search will break when this is live.

Both changed files carry the same risk: the search-with-ordering path. organization-[organization]/+page.ts is slightly higher concern because it uses Query.search() (a full-text search query) in the same query array as orderDesc('accessedAt').

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/auth/+page.ts Changes default user list ordering from natural order (orderDesc('')) to last-activity order (orderDesc('accessedAt')); depends on a backend attribute deployment.
src/routes/(console)/organization-[organization]/+page.ts Changes default project list ordering from natural order (orderDesc('')) to last-activity order (orderDesc('accessedAt')); search queries (Query.search + orderDesc) combination depends on backend support.

Comments Outside Diff (1)

  1. src/routes/(console)/organization-[organization]/+page.ts, line 53-69 (link)

    P2 Query.search + orderDesc('accessedAt') combination needs backend verification

    When search is set, searchQueries includes Query.search('search', search) alongside Query.orderDesc('accessedAt'). Full-text search queries in Appwrite typically cannot be combined with ordering on an unrelated attribute — the backend may reject the combination with a 400 error, breaking project search on the org page. This should be explicitly validated once appwrite#12645 is deployed before this goes to production.

Reviews (1): Last reviewed commit: "feat: sort users and projects by accesse..." | Re-trigger Greptile

Comment on lines 25 to 28
users: await sdk.forProject(params.region, params.project).users.list({
queries: [Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
queries: [Query.limit(limit), Query.offset(offset), Query.orderDesc('accessedAt')],
search
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Search + accessedAt ordering may conflict

The search string is passed as a separate top-level parameter alongside Query.orderDesc('accessedAt') in queries. Users who have never logged in will have a null accessedAt, so they'll always sort to the bottom regardless of search relevance — this is probably fine. The harder edge is whether the backend allows ordering by accessedAt when search is also provided: no other page in the codebase pairs a non-empty orderDesc field with the search param, so this is an untested combination. If the dependent backend PR (appwrite#12645) doesn't explicitly support ordering-with-search, this will break search on the Users page with a query error.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@HarshMN2345

Copy link
Copy Markdown
Member Author

@greptile Search + orderDesc('accessedAt') combination works fine, tested on staging — returns results correctly. Safe to merge.

@HarshMN2345 HarshMN2345 merged commit f0bc6b8 into main Jul 2, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the feat/sort-by-accessed-at branch July 2, 2026 12:37
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The developer has confirmed this works on staging — the search + orderDesc('accessedAt') combination returns results correctly. That's the key concern from my original comment addressed.

Good to go — if it's been validated on staging against the backend, the concern about the untested ordering-with-search combination is resolved. Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants