Skip to content

Conversation

@simonLeary42
Copy link
Collaborator

@simonLeary42 simonLeary42 commented Dec 9, 2025

Replaces the $modalErrors functionality from groups.php with a general-purpose message system. Messages are stored in the $_SESSION so that they aren't lost on redirect. Terminology stolen from Django and style stolen from coldfront

Future work:

  • send messages on uncaught exceptions
  • send messages on successful POST
  • make use of new pathJoin util

#327

image image image

@simonLeary42 simonLeary42 force-pushed the message-system branch 2 times, most recently from 1ccddcf to cdfc219 Compare December 10, 2025 17:25
Copy link
Contributor

Copilot AI left a 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 a Django-style message system to replace the previous modal-based error handling. The new system stores messages in the session and displays them at the top of pages after redirects, following the Post-Redirect-Get (PRG) pattern.

Key changes:

  • Added a new message system with five severity levels (debug, info, success, warning, error) using an enum-based API
  • Refactored error handling in groups.php to use the new message system instead of modal popups
  • Updated the redirect() method to default to the current page when no destination is provided

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
resources/lib/UnityHTTPD.php Adds UnityHTTPDMessageLevel enum and message storage/retrieval methods; updates redirect() signature to accept optional destination
resources/templates/header.php Displays session messages at top of page and removes old modal message elements
webroot/panel/groups.php Replaces $modalErrors array with new message system calls; adds redirects after error conditions
webroot/js/modal.js Removes message parameter from openModal() function signature
webroot/css/modal.css Removes modal message styling; minor formatting change
webroot/css/messages.css New file with styling for message banners with different severity levels
resources/lib/utils.php Adds pathJoin() utility function for URL path concatenation
resources/init.php Initializes $_SESSION["messages"] array if not present
test/phpunit-bootstrap.php Adds assertMessageExists() test helper function
test/functional/PIMemberRequestTest.php Updates test to check for messages using new helper instead of checking $_SESSION["MODAL_ERRORS"]

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 merged commit f253caa into main Dec 11, 2025
3 checks passed
@simonLeary42 simonLeary42 deleted the message-system branch December 11, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants