Skip to content

feat(web): pin the current user to the top of admin user list - #18345

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/web-admin-users-pin-current-user
Aug 17, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/web-admin-users-pin-current-user

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

feat(web): pin the current user to the top of admin user list

Admins most often act on their own account first, so surface it without scrolling or searching. Ordering the data rather than using row pinning keeps the row inside the existing search, filter, and pagination flow.

Admins most often act on their own account first, so surface it without
scrolling or searching. Ordering the data rather than using row pinning
keeps the row inside the existing search, filter, and pagination flow.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code labels Aug 17, 2026
@dcc123456
dcc123456 requested a review from wangq8 August 17, 2026 02:44
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Aug 17, 2026
@dcc123456
dcc123456 marked this pull request as draft August 17, 2026 02:44
@dcc123456
dcc123456 marked this pull request as ready for review August 17, 2026 02:44
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 59aa275b-9956-4fcf-9711-c8900a0181aa

📥 Commits

Reviewing files that changed from the base of the PR and between c6ba54b and 9772f39.

📒 Files selected for processing (1)
  • web/src/pages/admin/users.tsx

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The admin user list now places the authenticated user first when present. It preserves the order of other users and uses the reordered list as the table data source.

Changes

Admin user ordering

Layer / File(s) Summary
Memoized user ordering and table data
web/src/pages/admin/users.tsx
The page places the authenticated user first, handles unavailable users, preserves existing order when no reorder is needed, and passes the ordered list to the table.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9772f

This localized change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Suggested reviewers: skbs-eng

Poem

I sorted the users with a hop and a cheer,
Putting the signed-in one right to the front here.
The others stay steady in their original row,
While empty lists gently say, “Nothing to show.”
— A tidy admin rabbit 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: placing the current user at the top of the admin user list.
Description check ✅ Passed The description includes the required Summary section and explains the purpose, user benefit, and ordering approach.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this clean, well-scoped change. I reviewed the diff and cross-checked it against the current web/src/pages/admin/users.tsx.

What it does well

  • Correctly guards the usersList === undefined case by returning EMPTY_DATA, matching the previous usersList ?? EMPTY_DATA behavior.
  • findIndex returning -1 (current user not in the list) is handled correctly by the currentUserIndex <= 0 branch, so there's no accidental pinning or duplication.
  • Pinning is done by reordering the data source, so the current user still participates in search, filtering, and pagination (total count is unchanged) — consistent with the PR description.

Suggestions (non-blocking)

  1. Sorting overrides the pin: getSortedRowModel re-sorts the whole array, so once the user clicks a column header the current user moves back into their natural sorted position. Fine if the intent is "pin only in the default view", but worth confirming that's intentional.
  2. user.email === userInfo?.email is case-sensitive. This is consistent with the existing isMe checks in this file, so no change needed — just flagging in case emails can ever differ in casing.
  3. Minor style: usersList.filter((_, index) => index !== currentUserIndex) works, but something like slice+concat would read slightly more clearly. Optional.

No regressions, style, or security concerns spotted. LGTM overall.

@wangq8
wangq8 merged commit ddff47e into infiniflow:main Aug 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants