This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new c2a62804 fix: add feedback after successfully adding a user in admin 
panel (#1462)
c2a62804 is described below

commit c2a62804b0dcf31048eeb145e569ce0605d007ea
Author: Gregorius Bima Kharisma Wicaksana 
<[email protected]>
AuthorDate: Tue Dec 16 13:43:21 2025 +0700

    fix: add feedback after successfully adding a user in admin panel (#1462)
    
    ## Summary
    - Show success toast notification after user is added
    - Refresh user list and navigate to 'normal' filter on page 1 to display
    the newly added user
    
    ## Problem
    When adding a user in Admin -> Users, the page had no feedback after
    submission (as reported in #1457).
    
    **Root cause:** The code only refreshed the user list if the current
    filter was "all" or "staff", but the default filter is "normal".
    Additionally, there was no success toast notification.
    
    ## Solution
    1. Added toast notification to confirm successful user creation
    2. After adding user, navigate to "normal" filter page 1 and refresh the
    list so the new user is visible
    
    ## Test plan
    1. Go to Admin -> Users
    2. Click "Add User"
    3. Submit user information
    4. ✅ Success toast should appear
    5. ✅ Page should navigate to "normal" filter
    6. ✅ Newly added user should be visible in the list
    
    Fixes #1457
    
    ---------
    
    Co-authored-by: LinkinStars <[email protected]>
---
 i18n/en_US.yaml                      |  1 +
 ui/src/pages/Admin/Users/index.tsx   | 11 ++++++++---
 ui/src/pages/SideNavLayout/index.tsx |  2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index eac322da..705db9c2 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -2383,6 +2383,7 @@ ui:
     user_normal: This user is already normal.
     user_suspended: This user has been suspended.
     user_deleted: This user has been deleted.
+    user_added: User has been added successfully.
     badge_activated: This badge has been activated.
     badge_inactivated: This badge has been inactivated.
     users_deleted: These users have been deleted.
diff --git a/ui/src/pages/Admin/Users/index.tsx 
b/ui/src/pages/Admin/Users/index.tsx
index 7e8e4fd6..22042900 100644
--- a/ui/src/pages/Admin/Users/index.tsx
+++ b/ui/src/pages/Admin/Users/index.tsx
@@ -109,9 +109,14 @@ const Users: FC = () => {
       return new Promise((resolve, reject) => {
         addUsers(userModel)
           .then(() => {
-            if (/all|staff/.test(curFilter) && curPage === 1) {
-              refreshUsers();
-            }
+            toastStore.getState().show({
+              msg: t('user_added', { keyPrefix: 'messages' }),
+              variant: 'success',
+            });
+            urlSearchParams.set('filter', 'normal');
+            urlSearchParams.delete('page');
+            setUrlSearchParams(urlSearchParams);
+            refreshUsers();
             resolve(true);
           })
           .catch((e) => {
diff --git a/ui/src/pages/SideNavLayout/index.tsx 
b/ui/src/pages/SideNavLayout/index.tsx
index 907b9b28..b9bc38b9 100644
--- a/ui/src/pages/SideNavLayout/index.tsx
+++ b/ui/src/pages/SideNavLayout/index.tsx
@@ -38,7 +38,7 @@ const Index: FC = () => {
             <Outlet />
           </div>
         </div>
-        <div className="d-flex justify-content-center">
+        <div className="d-flex justify-content-center px-0 px-md-4">
           <div className="main-mx-with">
             <Footer />
           </div>

Reply via email to