Skip to content

Upd. Settings. Improve admins counter on settings page. - #728

Merged
svfcode merged 2 commits into
devfrom
upd-admin-counter
Sep 6, 2026
Merged

Upd. Settings. Improve admins counter on settings page.#728
svfcode merged 2 commits into
devfrom
upd-admin-counter

Conversation

@svfcode

@svfcode svfcode commented Sep 6, 2026

Copy link
Copy Markdown
Member

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread js/src/spbc-admin.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@svfcode
svfcode merged commit 723506e into dev Sep 6, 2026
5 checks passed
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.

2 participants