Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

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

chanxddff47e7cb0a
diff --git a/web/src/pages/admin/users.tsx b/web/src/pages/admin/users.tsx
index 9730eec576..eb249e5686 100644
--- a/web/src/pages/admin/users.tsx
+++ b/web/src/pages/admin/users.tsx
@@ -449,8 +449,27 @@ function AdminUserManagement() {
],
);
+ // Pin the current user to the top of the list
+ const orderedUsersList = useMemo(() => {
+ if (!usersList) {
+ return EMPTY_DATA;
+ }
+
+ const currentUserIndex = usersList.findIndex(
+ (user) => user.email === userInfo?.email,
+ );
+
+ if (currentUserIndex <= 0) {
+ return usersList;
+ }
+
+ const rest = usersList.filter((_, index) => index !== currentUserIndex);
+
+ return [usersList[currentUserIndex], ...rest];
+ }, [usersList, userInfo?.email]);
+
const table = useReactTable({
- data: usersList ?? EMPTY_DATA,
+ data: orderedUsersList,
columns: columnDefs,
globalFilterFn,