Skip to content

[user_accounts] to add SweetAlert2 reject user #10475

Open
priyavrat7 wants to merge 3 commits intoaces:mainfrom
priyavrat7:2026_04_27_ToAdd_SweetAlert2_rejectUser_to_reject
Open

[user_accounts] to add SweetAlert2 reject user #10475
priyavrat7 wants to merge 3 commits intoaces:mainfrom
priyavrat7:2026_04_27_ToAdd_SweetAlert2_rejectUser_to_reject

Conversation

@priyavrat7
Copy link
Copy Markdown

@priyavrat7 priyavrat7 commented Apr 28, 2026

Situation:
In the LORIS user_accounts module (edit_user interface), clicking the "Reject User" button triggers an immediate AJAX call to reject the account. There is no confirmation dialog, making it extremely easy for an administrator to accidentally reject a user with a misclick.

Task:
My objective was to introduce a confirmation step before executing the rejection AJAX call, ensuring a better and safer user experience. The implementation needed to adhere strictly to modern LORIS framework standards, specifically utilizing the SweetAlert2 library.

Action:

  • Refactored Legacy Code: Converted the plain jQuery script modules/user_accounts/js/rejectUser.js into a modern proper source file at modules/user_accounts/jsx/rejectUser.js.
  • Integrated SweetAlert2: Used modern Webpack imports (import swal from 'sweetalert2';) to implement a swal.fire() confirmation modal with a 'warning' type, standardizing the UI with other LORIS modules.
  • Updated Webpack Entry Point: Registered the new rejectUser file in webpack.config.ts under the user_accounts entry.
  • Compiled Bundle: Built the new asset via npm run compile, resulting in a self-contained Webpack JS bundle that replaces the old jQuery file.
  • Whitelisted: Whitelisted the compiled output in the module's .gitignore to prevent future tracking conflicts.

Result:
Administrators can now see SweetAlert2 warning dialog when attempting to reject a user. The AJAX call is correctly blocked until the user explicitly clicks "Yes, reject user!", completely preventing accidental rejections and fixes #10474.

image

rejectUser.js was a plain jQuery script that fired the rejection AJAX
call immediately on click with no confirmation. This converts it to a
webpack-compiled module and adds a swal.fire() confirmation dialog
before the action, consistent with the pattern used in other LORIS
modules.

Changes:
- Add jsx/rejectUser.js: new source with swal.fire() confirmation
- Compile to js/rejectUser.js: replace old jQuery with webpack bundle
- webpack.config.ts: register rejectUser as entry point for user_accounts
- Updated .gitignore, to be structurally correct and to prevent any future tracking issues
@github-actions github-actions Bot added Language: Javascript PR or issue that update Javascript code Module: user_accounts PR or issue related to the user_accounts module labels Apr 28, 2026
@priyavrat7 priyavrat7 added Category: Feature PR or issue that aims to introduce a new feature 26.0.0-bugs Issues that were raised during the release testing for 26.0.0 javascript Pull requests that update javascript code labels Apr 28, 2026
Copy link
Copy Markdown
Contributor

@jeffersoncasimir jeffersoncasimir left a comment

Choose a reason for hiding this comment

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

You should have either the .js + .gitignore exception or the .jsx + webpack change; not both.

@priyavrat7 priyavrat7 changed the base branch from 26.0-release to main April 28, 2026 17:56
@priyavrat7 priyavrat7 closed this Apr 28, 2026
@priyavrat7 priyavrat7 reopened this Apr 28, 2026
@priyavrat7 priyavrat7 removed the 26.0.0-bugs Issues that were raised during the release testing for 26.0.0 label Apr 28, 2026
… add swal confirmation.

Previously rejectUser.js was a plain jQuery script in /modules/js
that fired the rejection AJAX call immediately on click with no
confirmation. This converts it to a webpack-compiled module and
adds a swal.fire() confirmation dialog before the action, consistent
 with the pattern used in other LORIS modules.

Changes:
- Add jsx/rejectUser.js: new source with swal.fire() confirmation
- webpack.config.ts: register rejectUser as entry point for user_accounts
@priyavrat7 priyavrat7 force-pushed the 2026_04_27_ToAdd_SweetAlert2_rejectUser_to_reject branch from 09203bb to c419a66 Compare April 30, 2026 19:10
@priyavrat7 priyavrat7 changed the title [user_accounts] to add sweet alert2 reject user to reject [user_accounts] to add SweetAlert2 reject user Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Feature PR or issue that aims to introduce a new feature javascript Pull requests that update javascript code Language: Javascript PR or issue that update Javascript code Module: user_accounts PR or issue related to the user_accounts module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[user_accounts] Add SweetAlert2 confirmation dialog to 'Reject User' action

3 participants