#5773 - Site messaging JSON is broken
| Identifier | #5773 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Site messaging JSON is broken |
| Status | Completed |
| Tags |
Roadmap: Over the horizon (custom) Roadmap: v11 (custom) |
| Handling member | PDStig |
| Version | 11 alpha4 |
| Addon | actionlog |
| Description | The feature to specify multiple site messages using JSON is broken.
site.php is not properly reading the JSON and thus throwing errors about messages key not existing in the array (even if it exists in the JSON), and type errors. Also, documentation in tut_news about syntax is wrong and needs updating. |
| Steps to reproduce | |
| Additional information | See comments about an alternative solution |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
Instead, we should probably strip this config option out into its own XML screen (like field filters / advanced banning). Provide a commented example in the XML.
This would also allow us to expand on its functionality in the future if we want, for example allowing to specify specific pages to show a message (this could be very handy for staff use. For example, staff could have a to-do message display to remind others to sync comcode pages to git after actualising an add or edit).
Or alternatively, make this a UI module with the ability to add/edit/delete messages individually. Make it its own addon and call it "site_messaging" (I don't think it needs to be core (but it should be bundled); I see no reason why a user shouldn't be able to uninstall it). Make site messages resource meta-aware in resource_fs so they can also be automated. Add a privilege to define who can add/edit site messages, defaulting to staff only. Update documentation accordingly to explain this small module/addon.
Site messaging was broken when trying to specify multiple messages.
This hotfix guts the old site messaging system and removes the configuration options, then adds a new addon called 'site_messaging'. Site messages are now handled through their own screen under Admin Zone > Setup > Site messaging.
I decided to go this route because I did not like the previous implementation where there were fields for a single message, but then to specify multiple messages, you had to use JSON (which is easy to get wrong) inside the Comcode-type field. This did not seem appropriate from a contextual and validation point of view.
This also adds on the ability to put messages on specific pages by specifying page-links.
However, I do want to add some nuance/context...
There's always a tradeoff between quality and where we choose to put our resources. We need to have a baseline of quality, but less important/commonly-used features may reasonably implemented in a more clunky way than more important ones. Hand-writing JSON is an example of that. But given there were apparently insufficient guard rails, probably we'd either have needed to add those, moved the feature to a hidden one, or did it the idealized way anyway. So no complaints from me.