Redesign "FAQ's" page#441
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe FAQ page now uses native ChangesFAQ Page Redesign and Content Refresh
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
✅ Deploy Preview for decidim-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
source/javascripts/filter-by-content.js (1)
17-18: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winMove RegExp creation outside the loop.
Creating a new RegExp object for every
[data-filter-target]element is inefficient. Create it once before the loop to improve performance, especially for pages with many FAQ items.♻️ Proposed refactor
if (parent) { + const regex = new RegExp(value, "i"); [...parent.querySelectorAll("[data-filter-target]")].forEach((x) => { - const matches = x.textContent.match(new RegExp(value, "i")); + const matches = x.textContent.match(regex); if (!matches) {Note: This should be applied after fixing the ReDoS vulnerability mentioned in the previous comment.
🤖 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 `@source/javascripts/filter-by-content.js` around lines 17 - 18, The RegExp object is being created on every iteration of the forEach loop that processes elements selected by querySelectorAll("[data-filter-target]"). Move the RegExp creation outside the forEach loop by creating it once before the loop starts, storing it in a variable, and then using that variable reference inside the forEach callback where match() is called. This will prevent unnecessary RegExp instantiation for each element.
🤖 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 `@locales/en.yml`:
- Line 172: Remove the HTML `<span>` tags and embedded email from the i18n
string at locales/en.yml line 172 and replace it with a placeholder like
%{email}. Then update the template at source/localizable/faqs.html.erb line 13
where it renders the subtitle to pass the email as an interpolated parameter
using a template helper like tag.span() to wrap the email address with the
styling classes (underline, decoration-2, text-red-500) instead of embedding the
markup in the translation string. This keeps HTML out of i18n strings and
prevents ERB escaping issues.
In `@source/javascripts/filter-by-content.js`:
- Around line 17-28: The code creates a RegExp directly from unescaped user
input (the `value` variable) in the forEach loop, creating a ReDoS vulnerability
where malicious patterns can freeze the browser. Replace the RegExp matching
with safe case-insensitive string matching by converting both the text content
and the search value to lowercase and using the `.includes()` method instead of
`.match(new RegExp(value, "i"))`. This eliminates the regex compilation from
user input while maintaining the same filtering functionality.
In `@source/localizable/faqs.html.erb`:
- Line 40: The `group-open:` TailwindCSS variant used in the `group-open:block
hidden` class on line 40 of the faqs.html.erb template is not configured for
TailwindCSS v3. To fix this, either add the `group-open:` variant configuration
to your tailwind.config.js file, or replace the `group-open:block hidden` class
with `open:block hidden` to use TailwindCSS's built-in `open:` modifier for
`<details>` elements. The second approach is simpler and requires no additional
configuration.
---
Nitpick comments:
In `@source/javascripts/filter-by-content.js`:
- Around line 17-18: The RegExp object is being created on every iteration of
the forEach loop that processes elements selected by
querySelectorAll("[data-filter-target]"). Move the RegExp creation outside the
forEach loop by creating it once before the loop starts, storing it in a
variable, and then using that variable reference inside the forEach callback
where match() is called. This will prevent unnecessary RegExp instantiation for
each element.
🪄 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
Run ID: 84b3c1ee-2d73-464d-a94d-d08b66c486e6
📒 Files selected for processing (4)
locales/en.ymlsource/javascripts/filter-by-content.jssource/localizable/faqs.html.erbsource/partials/_faq-item.html.erb
Done |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…to faqs/faqs-section
|
Hello @greenwoodt copies are not updated. You can find all FAQs copies here: https://docs.google.com/document/d/1GM2HfcQMJ1VAABQapZU7YTcoMe8cghIme-ug4mfdSKI/edit?tab=t.0#heading=h.utgv9hbc60wm |
This is done and ready for review. You can view the translations in the |
|
Hello @greenwoodt in the FAQs section there's a question missing: I want to contribute to the project proposing new improvements. What can I do? ( In the Installation and license section) The rest is perfect! |
Added:
Going to assign to @andreslucena for a code review |



This PR creates the FAQ section for the redesign of the site according to the design here: https://www.figma.com/design/4dRzG7s6PzatpgTlcXiABh/Web-decidim.org?node-id=1375-23294&m=dev
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Style
Content Updates