Upd. Settings. Improve admins counter on settings page. - #728
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The updated counter refresh uses jQuery .html() for inserting a numeric value, and switching to .text() would reduce XSS risk with no functional downside.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Settings page “admins online” counter so it can be displayed and refreshed consistently in the React header (and kept in sync with the existing admin-bar counter refresh).
Changes:
- Refactors
Settings::getAdminsOnline()to return structured data (html,count,names) and wires it into the page-data payload. - Extends the periodic AJAX refresh to update the Settings header counter in addition to the admin-bar counter.
- Updates React header components to render the admins-online counter and tooltip text from server-provided data.
File summaries
| File | Description |
|---|---|
| lib/CleantalkSP/SpbctWP/Views/Settings.php | Returns admins-online data as {html,count,names} and exposes it to the React page payload. |
| js/src/spbc-admin.js | Updates the counter-refresh selector to also target the Settings header counter element. |
| js/src/react/pageElements/Header/Header.js | Passes admins-online counter + names into the state-info header block. |
| js/src/react/components/HeaderStateInfoBlock/HeaderStateInfoBlock.js | Renders admins-online counter and names (tooltip) from props instead of hardcoding. |
| js/spbc-admin.min.js | Rebuilt minified admin script to include the selector change. |
| js/spbc-admin.min.js.map | Updated source map to match the rebuilt minified admin script. |
| js/public/spbct-react-bundle.js | Updated compiled React bundle with the new header props/behavior. |
Review details
- Files reviewed: 5/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The changes consistently wire admins-online count/names from PHP to the React header and update the existing JS refresh path without introducing unsafe rendering or broken call sites.
Review details
- Files reviewed: 5/7 changed files
- Comments generated: 0 new
- Review effort level: Lite
task https://app.doboard.com/1/task/42426