feat: add custom HTML fields for portals#233
Conversation
|
@coderabbitai review @codex review |
|
✅ Actions performedReview triggered.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 WalkthroughWalkthroughThis pull request adds custom HTML injection support to portals. Changes include database schema extensions for two new text fields (custom_head_html and custom_body_html), backend parameter whitelisting and validation, frontend form UI for editing, API serialization, portal layout template rendering logic, and internationalization strings. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 622594cabb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue (1)
363-410: Consider extracting the duplicated custom-HTML field block.Both sections only vary by binding and i18n key prefix. A small config-driven render or subcomponent would keep future validation or accessibility tweaks in one place.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue` around lines 363 - 410, The two duplicated textarea blocks in PortalBaseSettings.vue (bound to state.customHeadHtml and state.customBodyHtml and using i18n keys HELP_CENTER.PORTAL_SETTINGS.FORM.CUSTOM_HEAD_HTML / CUSTOM_BODY_HTML) should be consolidated: extract them into a single reusable subcomponent (e.g., CustomHtmlField) or a small render helper that accepts props for the v-model key and the i18n prefix, then replace both blocks with that component/call; ensure the new component forwards the v-model, placeholder, rows, classes, and help text so future validation or accessibility changes are made in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue`:
- Around line 372-403: The two unbounded textareas bound to state.customHeadHtml
and state.customBodyHtml in PortalBaseSettings.vue need a client-side size cap
to mirror the server-side limit: add maxlength attributes to both textarea
elements (using the same max bytes/characters enforced by the server) and
implement a simple inline counter/error bound to those model values (e.g.,
computed remainingChars or isOverLimit) to display remaining characters and a
validation message preventing submit when exceeded; update any submit
handler/validation method (the form submit or save routine in this component) to
check the same limit before sending to the server.
---
Nitpick comments:
In
`@app/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vue`:
- Around line 363-410: The two duplicated textarea blocks in
PortalBaseSettings.vue (bound to state.customHeadHtml and state.customBodyHtml
and using i18n keys HELP_CENTER.PORTAL_SETTINGS.FORM.CUSTOM_HEAD_HTML /
CUSTOM_BODY_HTML) should be consolidated: extract them into a single reusable
subcomponent (e.g., CustomHtmlField) or a small render helper that accepts props
for the v-model key and the i18n prefix, then replace both blocks with that
component/call; ensure the new component forwards the v-model, placeholder,
rows, classes, and help text so future validation or accessibility changes are
made in one place.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a4e200f0-4503-4e40-bb46-92085fc03918
📒 Files selected for processing (9)
app/controllers/api/v1/accounts/portals_controller.rbapp/javascript/dashboard/components-next/HelpCenter/Pages/PortalSettingsPage/PortalBaseSettings.vueapp/javascript/dashboard/i18n/locale/en/helpCenter.jsonapp/javascript/dashboard/i18n/locale/pt_BR/helpCenter.jsonapp/models/portal.rbapp/views/api/v1/accounts/portals/_portal.json.jbuilderapp/views/layouts/portal.html.erbdb/migrate/20260309131532_add_custom_html_to_portals.rbdb/schema.rb
Pull Request Template
Description
Please include a summary of the change and issue(s) fixed. Also, mention relevant motivation, context, and any dependencies that this change requires.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
Checklist:
This change is
Summary by CodeRabbit
Release Notes