Steps to replicate the issue in T386779:
- Enable Cat-a-lot from preferences.
- Open category Category:Zache-test_Test_Images with a protected file (e.g., Protected TestFileUploadFile-CB919860-BAF7-42B7-A960-DF2BC1CF6B1D.jpg).
- Open the Cat-a-lot dialog (bottom-right corner).
- Select the protected file. Protected TestFileUploadFile-CB919860-BAF7-42B7-A960-DF2BC1CF6B1D.jpg.
- Try to remove the category using Cat-a-lot.
What happens?:
- API returns error, which is handled incorrectly (program doesn't crash but it fails to continue)
- in-progress dialog stays open forever
What should have happened instead?:
- A notification should inform the user about the error.
- Options should be available to ignore the error and continue or stop all editing.
Fix Implemented
The issue was in Cat-a-lot.js. The API error handling was missing proper callbacks, leading to an unresponsive UI.
Changes Made in (Cat-a-lot.js)
- Added error callback parameter (was missing in editPageParams).
- Implemented visual error notifications .
- Added user options: "Ignore and continue" or "Stop all editing".
- Introduced 4 new i18n messages for error titles and actions.
- Designed a modal dialog for clear error focus.
Code Changes for Review:
- Gadget-Cat-a-lot.js: User:Ademola01/Gadget-Cat-a-lot.js - View Diff
- Cat-a-lot.css: User:Ademola01/cat-a-lot.css - View Diff
- Gadget-libAPI.js: User:Ademola01/Gadget-libAPI.js - View Diff
How to load files
- Load the modified script by pasting it in Special:Mypage/common.js in Beta Commons:
mw.loader.load(mw.config.get('wgServer') + '/w/index.php?title=User:Ademola01/Gadget-Cat-a-lot.js&action=raw&ctype=text/javascript');
Note
The test environment is on BETA commons.
Also, i've implemented the necessary changes to improve error handling in Cat-a-lot when attempting to edit a protected file. The fix ensures that users receive a clear error message with options to either ignore the error and continue or stop all editing. Please take a look at my implementation, and I welcome any feedback or suggestions for further improvements.
Let me know if any adjustments are needed. Thanks!
