-
Notifications
You must be signed in to change notification settings - Fork 11
delete messages using ajax #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4552701 to
0561da6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements AJAX-based deletion of user messages, allowing messages to persist across page refreshes until explicitly dismissed by clicking the X button. The implementation adds a new AJAX endpoint and supporting methods to the UnityHTTPD library.
Key Changes:
- Added AJAX endpoint for deleting individual messages based on level, title, and body pattern matching
- Implemented
getMessage()anddeleteMessage()methods in UnityHTTPD for message management - Modified message display template to call the AJAX endpoint instead of immediately hiding messages
- Removed automatic message clearing and replaced test helper function with direct
getMessage()calls
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| webroot/panel/ajax/delete_message.php | New AJAX endpoint that handles POST requests to delete messages from session storage |
| resources/lib/UnityHTTPD.php | Added getMessage(), deleteMessage(), and getMessageIndex() methods; refactored getPostData() with more explicit validation |
| resources/templates/header.php | Modified message display to include AJAX call for deletion and removed automatic clearMessages() call |
| resources/lib/exceptions/UnityHTTPDMessageNotFoundException.php | New exception class for when a message matching the criteria is not found |
| resources/autoload.php | Added require statement for new exception class |
| test/phpunit-bootstrap.php | Added require for new exception and removed assertMessageExists() helper function |
| test/functional/PIMemberRequestTest.php | Replaced assertMessageExists() call with getMessage() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
demo: new random message is generated each refresh and persists across refreshes until the user clicks the X
Screen.Recording.2025-12-11.at.3.21.16.PM.mov
demo 2: error message on POST
Screen.Recording.2025-12-11.at.3.23.24.PM.mov