Skip to content

Fix: Show object names without HTML entities - #315

Merged
KingYes merged 3 commits into
masterfrom
fix/object-name-entities
Nov 18, 2026
Merged

KingYes merged 3 commits into
masterfrom
fix/object-name-entities

Conversation

@KingYes

@KingYes KingYes commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

What

Object names in the activity log table, CSV export, and REST/Abilities output showed literal HTML entities (for example & and ’) instead of & and apostrophes.

Why

Hooks stored esc_html( get_the_title() ), so titles were saved HTML-encoded after WordPress typography/character conversion. The presenter applied esc_html() again, and the React UI rendered the result as plain text.

How

  • Store raw post titles via get_post_field( 'post_title', ... ) when logging posts, attachments, and comment parent posts.
  • Decode legacy HTML-encoded object_name values in AAL_Log_Presenter for table descriptions, export, and REST/Abilities JSON.

Fixes #312. Supersedes #313 — thanks a lot @solracsf for reporting the issue and for the contribution! This PR fixes the root cause at write time and decodes existing rows in every output (table, export, REST).

Open in Web Open in Cursor 

✨ PR Description

1. Problem & Context

Object names were being stored in the database as HTML-encoded strings, leading to double-encoding or incorrect raw output in JSON/CSV exports. The goal is to store raw data and decode legacy entries during presentation.

2. What Changed (Where)

File Change
class-aal-log-presenter.php Added plain_object_name() helper to decode HTML entities for all output formats.
class-aal-hook-attachments.php Replaced esc_html() with get_post_field() for raw title storage.
class-aal-hook-comments.php Replaced esc_html() with get_post_field() for raw title storage.
class-aal-hook-posts.php Replaced esc_html(get_the_title()) with get_post_field() for raw storage.
test-hook-posts.php Added test for raw ampersand storage.
test-log-presenter-object-name.php Added tests for legacy HTML entity decoding in JSON and exports.

3. How It Works

The storage layer now bypasses esc_html to save raw strings. The AAL_Log_Presenter now intercepts object_name via plain_object_name(), using html_entity_decode to ensure both legacy encoded and new raw strings are normalized before being sent to the UI or export files.

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
KingYes and others added 2 commits November 18, 2026 19:36
Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
Co-authored-by: Yakir Sitbon <KingYes@users.noreply.github.com>
@KingYes
KingYes merged commit 985805e into master Nov 18, 2026
51 checks passed
@KingYes
KingYes deleted the fix/object-name-entities branch November 18, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encoding issue on Meta column

1 participant