Fix. SecurityLog. Fixed ip column and timeline render. - #724
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets the Security Log UI by improving the user-activity timeline’s rendering behavior (especially around accordion visibility/resize) and correcting how IP addresses are prepared/displayed in the Security Log table.
Changes:
- Added timeline init guards and a centralized “redraw current timeline” path to improve timeline rendering on resize/accordion interaction.
- Adjusted Security Log IP preparation to normalize IPv6 values for display/actions.
- Updated the shipped minified timeline bundle.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| js/src/spbc-timeline-widget.js | Adds init guarding and redraw logic for the Security Log timeline widget, including accordion/resize behavior. |
| js/spbc-timeline-widget.min.js | Updates the minified asset corresponding to the timeline widget. |
| inc/spbc-settings.php | Updates Security Log IP formatting/normalization and how IPs are shown in the table. |
Suppressed comments (2)
js/src/spbc-timeline-widget.js:116
redrawCurrentTimeline()can be called from the windowresizelistener even wheninitTimeline()hasn’t successfully run yet (e.g., when the widget DOM is injected later and the MutationObserver is waiting). In that case the draw methods will throw when required DOM nodes don’t exist yet. Guard redraws until initialization has completed.
redrawCurrentTimeline() {
if (!this.selectedUserValue) {
return;
}
if (this.selectedUserValue === 'most_active__action') {
inc/spbc-settings.php:767
sprintf()is currently passed 3 arguments but the format string contains only 2 placeholders, so$country_partis never rendered. Also, the two displayed IP values are identical, which makes the second line redundant. Consider showing the raw logged IP and the normalized one, and include the country part in the format string.
$ip_part = sprintf(
'<a href="' . $ip_blacklist_link . '" target="_blank">%s<i class="spbc-icon-link-ext"></i></a><br>%s',
$ip,
$ip,
$country_part
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
js/src/spbc-timeline-widget.js:64
tryInit()only assigns the redraw handler via the accordionactivateoption when it initializes the accordion itself. In this file,spbcTimelineWidgetRender()also initializes#spbc-timeline-accordionon DOM ready without anactivatehandler (see js/src/spbc-timeline-widget.js:1001-1006), which can overwrite/prevent the redraw hook and leave the SVG rendered at 0 width after expanding the accordion. Bind to theaccordionactivateevent unconditionally (namespaced) so the redraw handler survives accordion re-initialization regardless of where it happens.
// Draw first, while the panel is still visible. jQuery accordion
// with active:false sets display:none and clientWidth becomes 0.
this.initTimeline();
const $acc = jQuery(accordion);
if ($acc.length && ! $acc.hasClass('ui-accordion')) {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
task https://app.doboard.com/1/task/44430