Skip to content

feat(admin): show recently impersonated users in admin panel#5750

Merged
waleedlatif1 merged 4 commits into
stagingfrom
feat/recent-impersonation
Jul 17, 2026
Merged

feat(admin): show recently impersonated users in admin panel#5750
waleedlatif1 merged 4 commits into
stagingfrom
feat/recent-impersonation

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Track the last 5 impersonated users (emails only) in localStorage and show them as default rows in the admin User Management table
  • Searching replaces the recents with search results; clearing the search brings them back
  • Recents resolve to live user rows via a new useAdminUsersByEmails query (exact email match), so role/ban status is always current and all row actions work on them
  • Allowlist the recent-impersonations key in clearUserData so impersonation switches/sign-outs don't wipe it
  • Extract the user row + table header into shared render helpers; fix undefined --border-secondary token to --border; tighten Name/Role/Status/Actions column widths so Email doesn't truncate

Type of Change

  • New feature

Testing

Tested manually. Lint, type-check, and check:api-validation:strict pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 17, 2026 10:42pm

Request Review

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Additive admin UI and client-side email history; impersonation and ban/promote APIs are unchanged aside from recording email on success.

Overview
Adds a recent impersonations shortcut in User Management: when the search box is empty, the table shows up to the last five users you impersonated on this browser (emails stored in localStorage, resolved live via a new useAdminUsersByEmails query so role/ban state and row actions stay current). A successful impersonate now records that user’s email before clearUserData runs.

clearUserData allowlists the recent-impersonations key so impersonation switches don’t wipe the list. Search still replaces the table with paginated results; clearing search brings recents back.

Refactors the user table into shared USER_TABLE_HEADER and renderUserRow, and tightens column widths so email truncates less.

Reviewed by Cursor Bugbot for commit 24803be. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds recently impersonated users to the admin user-management panel. The main changes are:

  • Stores the five most recent impersonation emails in localStorage.
  • Resolves saved emails to current user records with exact server-side filters.
  • Shows recent users when the search field is empty.
  • Preserves the recent list during sign-out and impersonation cleanup.
  • Reuses table row rendering and adjusts column styling.

Confidence Score: 5/5

This looks safe to merge.

  • Storage failures no longer interrupt cleanup and navigation after impersonation.
  • Exact server-side email filters remove the earlier pagination cutoff.
  • No blocking issue remains in the updated paths.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/settings/components/admin/admin.tsx Adds the recent-user view and shares row rendering between recent and searched users.
apps/sim/app/workspace/[workspaceId]/settings/components/admin/use-recent-impersonations.ts Adds bounded, deduplicated localStorage history with guarded reads and writes.
apps/sim/hooks/queries/admin-users.ts Adds a query that resolves stored emails through server-side equality filters.
apps/sim/stores/index.ts Preserves recent impersonation history when clearing user-specific state.

Reviews (3): Last reviewed commit: "fix(admin): exact server-side email filt..." | Re-trigger Greptile

Comment thread apps/sim/stores/index.ts
Comment thread apps/sim/hooks/queries/admin-users.ts Outdated
Comment thread apps/sim/stores/index.ts Outdated
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/hooks/queries/admin-users.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a636c3d. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile review

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 24803be. Configure here.

@waleedlatif1
waleedlatif1 merged commit a4e2fb9 into staging Jul 17, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/recent-impersonation branch July 17, 2026 23:44
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