Fix admin JS/CSS namespace leaks missed in rename#31
Conversation
Phase 9 missed assets/js/admin.js and one admin.css class. The PHP renders ettic_otc_* ids and .ettic-otc-* classes, but the JS still queried opentrust_* ids and the _opentrust_ meta prefix, so the accent contrast preview, version-summary toggle, and cert-type catalog autofill silently broke. Realign selectors, regex, and the model-unavailable class; update stale OpenTrust references in JS/CSS/XML comments and chat storage key.
📝 WalkthroughWalkthroughThis PR updates product branding and DOM naming conventions across the codebase. CSS selectors, JavaScript element IDs, storage keys, and configuration comments are systematically renamed from "OpenTrust"/"opentrust" to "Open Trust Center"/"ettic-otc" to align with new product terminology. ChangesOpen Trust Center Rebranding
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@assets/js/chat.js`:
- Line 25: The sessionStorage key var STORAGE_KEY = 'ettic-otc.chat.history'
will drop existing history stored under 'opentrust.chat.history'; update
loadHistory() to perform a one-time migration: if nothing exists under
STORAGE_KEY but data exists under the old key 'opentrust.chat.history',
copy/parse that value into STORAGE_KEY (and optionally remove the old key) so
existing conversations are preserved; reference the STORAGE_KEY constant and the
loadHistory() function when making this change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b1b5e02-40fa-4939-acef-7ac88ff472c4
📒 Files selected for processing (6)
assets/css/admin.cssassets/css/chat.cssassets/js/admin.jsassets/js/chat.jsassets/js/frontend.jswpml-config.xml
|
|
||
| var strings = config.strings || {}; | ||
| var STORAGE_KEY = 'opentrust.chat.history'; | ||
| var STORAGE_KEY = 'ettic-otc.chat.history'; |
There was a problem hiding this comment.
Note: sessionStorage key change will clear existing chat history.
The sessionStorage key has been renamed from opentrust.chat.history to ettic-otc.chat.history. This means users with existing chat history will lose their conversation history after this update, as the code will no longer read from the old key.
This is likely intentional as part of the rebranding, but it's worth noting that the impact is:
- Existing chat sessions will appear empty on first load after the update
- Users will need to start fresh conversations
If preserving history is important, you could add a one-time migration in the loadHistory() function that checks the old key and copies data to the new key.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@assets/js/chat.js` at line 25, The sessionStorage key var STORAGE_KEY =
'ettic-otc.chat.history' will drop existing history stored under
'opentrust.chat.history'; update loadHistory() to perform a one-time migration:
if nothing exists under STORAGE_KEY but data exists under the old key
'opentrust.chat.history', copy/parse that value into STORAGE_KEY (and optionally
remove the old key) so existing conversations are preserved; reference the
STORAGE_KEY constant and the loadHistory() function when making this change.
Final namespace sweep before WP.org resubmission turned up real breakage the big rename (#28) missed in
assets/js/admin.jsand oneadmin.cssclass.What was broken
The PHP renders the new namespace, but admin.js still queried the old one:
#ettic_otc_accent_color,#ettic-otc-accent-warning#opentrust_*#ettic_otc_publish_new_version,#ettic_otc_version_summary#opentrust_*_ettic_otc_*replace(/^_opentrust_/…).ettic-otc-ai-model-unavailable.opentrust-ai-model-unavailableThese are admin-edit-screen behaviors, which is why frontend/chat QA didn't catch them.
Also
Updated stale
OpenTrustreferences in JS/CSS/XML header comments and the chatlocalStoragekey. No translatable strings changed (POT untouched).After this, the only
opentruststrings left in shipped code are intentional: the importer legacy back-compat maps, the readme changelog, and the Docs link URL.🤖 Generated with Claude Code
Summary by CodeRabbit
Refactor
Chores