Skip to content

Conversation

andersonjeccel
Copy link
Contributor

Q A
Bug fix? (use the a.b branch)
New feature/enhancement? (use the a.x branch) ✔️
Deprecations?
BC breaks? (use the c.x branch)
Automated tests included? ✔️
Related user documentation PR URL N/A
Related developer documentation PR URL N/A
Issue(s) addressed Fixes #15244

Description

This PR implements the request from issue #15244 to set "Disable search indexing" as enabled by default for new forms while keeping the toggle visible for user control.

Changes Made

  1. Form Entity (Form.php): Set noIndex = true by default in constructor for new forms
  2. Form Type (FormType.php): Keep the toggle visible but show it as enabled by default
  3. Tests (FormTest.php): Updated test expectations to match new default behavior

Benefits

  • Better UX: New forms automatically have search indexing disabled (better default for most use cases)
  • User Control: Toggle remains visible so users can change the setting if needed
  • Backward Compatible: Existing forms preserve their current settings
  • SEO Friendly: Prevents form pages from being indexed by search engines by default

Testing Instructions

  1. Create a new form - verify "Disable search indexing" toggle is checked by default
  2. View form page - should include <meta name="robots" content="noindex">
  3. Edit existing forms - verify their current settings are preserved unchanged
  4. Toggle the setting - verify you can still enable/disable as needed
  5. Run tests - ddev exec composer test -- app/bundles/FormBundle/Tests/Entity/FormTest.php

Implementation Details

  • New forms start with noIndex = true (search indexing disabled)
  • Form UI shows the toggle with appropriate default state
  • No breaking changes to existing functionality
  • All existing tests updated and passing

@andersonjeccel andersonjeccel added T1 Low difficulty to fix (issue) or test (PR) ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging user-experience Anything related to related to workflows, feedback, and navigation enhancement Any improvement to an existing feature or functionality forms Anything related to forms labels Jul 14, 2025
@andersonjeccel andersonjeccel self-assigned this Jul 14, 2025
Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jos0405 jos0405 added code-review-passed PRs which have passed code review and removed code-review-needed PR's that require a code review before merging labels Jul 17, 2025
@jos0405 jos0405 moved this to 🦸🏻 Needs 2 tests in Open Source Fridays Jul 17, 2025
Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, but @andersonjeccel can we add one of your wonderful help tooltips to explain what this actually does (it prevents the form URL from being indexed in search engines) - can do that in another PR. Thanks!

Copy link

@RCheesley RCheesley added pending-test-confirmation PR's that require one test before they can be merged and removed ready-to-test PR's that are ready to test labels Jul 22, 2025
@RCheesley RCheesley added this to the 7.0.0-alpha milestone Jul 22, 2025
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.65%. Comparing base (6803ff6) to head (3f76382).
Report is 13 commits behind head on 7.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                7.x   #15255   +/-   ##
=========================================
  Coverage     66.64%   66.65%           
+ Complexity    35046    35045    -1     
=========================================
  Files          2300     2299    -1     
  Lines        141364   141372    +8     
=========================================
+ Hits          94210    94226   +16     
+ Misses        47154    47146    -8     
Files with missing lines Coverage Δ
app/bundles/FormBundle/Entity/Form.php 93.43% <100.00%> (+0.02%) ⬆️
app/bundles/FormBundle/Form/Type/FormType.php 98.75% <100.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andersonjeccel andersonjeccel added ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged user-testing-passed PRs which have been successfully tested by the required number of people. and removed pending-test-confirmation PR's that require one test before they can be merged labels Jul 22, 2025
@andersonjeccel andersonjeccel moved this from 🦸🏻 Needs 2 tests to 🎉 Ready to commit in Open Source Fridays Jul 22, 2025
@escopecz escopecz merged commit 6302d29 into mautic:7.x Jul 23, 2025
26 checks passed
@github-project-automation github-project-automation bot moved this from 🎉 Ready to commit to 🥳 Done in Open Source Fridays Jul 23, 2025
@andersonjeccel andersonjeccel deleted the forms-disable-search-indexing-by-default branch July 23, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review enhancement Any improvement to an existing feature or functionality forms Anything related to forms ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged T1 Low difficulty to fix (issue) or test (PR) user-experience Anything related to related to workflows, feedback, and navigation user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

Forms: Remove "Disable search indexing" option - instead, always disable.
5 participants