Skip to content

Fix front end message spacing issues#2429

Merged
Crabcyborg merged 4 commits into
masterfrom
fix_front_end_message_spacing_issues
Jul 16, 2025
Merged

Fix front end message spacing issues#2429
Crabcyborg merged 4 commits into
masterfrom
fix_front_end_message_spacing_issues

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 16, 2025

## Walkthrough

The update modifies the logic for processing form success messages, making autop formatting conditional based on message content and a new filter. Additionally, CSS rules for message paragraph spacing are adjusted to refine vertical margins within styled form message containers. The related test was updated to reflect the changed HTML structure of the success message output.

## Changes

| File(s)                             | Change Summary                                                                                     |
|-----------------------------------|--------------------------------------------------------------------------------------------------|
| classes/helpers/FrmFormsHelper.php | Updated `get_success_message` to conditionally apply autop formatting based on line breaks and a new filter hook. |
| css/custom_theme.css.php            | Modified `.frm_message p` margin-bottom to 0 and added rule to remove margin-top from first paragraph. |
| tests/phpunit/forms/test_FrmFormsController.php | Updated test assertions to use `assertStringContainsString` and reflect success message without wrapping `<p>` tag. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant FrmFormsHelper
    participant FrmAppHelper
    participant WordPress
    Note over FrmFormsHelper: get_success_message called
    FrmFormsHelper->FrmFormsHelper: Check for line breaks in message
    FrmFormsHelper->WordPress: Apply frm_wpautop_success_message filter
    alt autop is true
        FrmFormsHelper->FrmAppHelper: use_wpautop(message)
    end
    FrmFormsHelper->WordPress: do_shortcode(message)
    FrmFormsHelper->User: Return formatted message in <div>

<!-- walkthrough_end -->
<!-- This is an auto-generated comment: all tool run failures by coderabbit.ai -->

> [!WARNING]
> There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
> 
> <details>
> <summary>🔧 PHPStan (2.1.17)</summary>
> 
> Note: Using configuration file /phpstan.neon.
> Invalid configuration:
> Unexpected item 'parameters › strictRules'.
> 
> 
> 
> </details>

<!-- end of auto-generated comment: all tool run failures by coderabbit.ai -->


---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 2df081efa9df147880b0c05515297f08f2d88868 and 356ddbd617d12b2f6bb68b5a1076754217764b5a.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `tests/phpunit/forms/test_FrmFormsController.php` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* tests/phpunit/forms/test_FrmFormsController.php

</details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAMXgAD0gAMwp8DFCyejZERDRSe240BngMIhRc4MRoyAB3NGQHAWZ1Gno5MNgPbERKSABhKgEGWQF8CnKG6zsMRwE+gCYAFgWATg0YLs8Kbnxe/mTO1FsKsPx0Wlp/XPQMemTEwuLS8qQHaT8SL2ooghS0jJgLKQHJ5UiIDbuRiwTAFRDcUTwB4MNA+eTXfBeKTIXBbN7BSC0fAMRzsKLUSCwXC4biIDgAenpRHUsGwAg0TGY9IAyrgqDQiLIAIxC+nJcYtWgqSJgXj4en46T0gCsqwADEKNgA5c5oS7qeDpVGE6QMCjwbjidL8PjwZjcSJsDLUQ1YJS4bReZC1SgeOUSeBKWiQrYnFFYeafAMkH30ClUml0xnM3FsjksHl8n6CkViiWB6UkMDiijMRD07jeLz05ZrDRGfTGcBQYH4Q5oPCEUjkflRTlOzg8PiCERiSQfDpMJRDNSabS6MCGExQOCoVCYHAEYhkZRtBSsdhcKi1eyOZjOeSTxTKVTqLQ6RtN0wGBjfXJKrpeBEUcuxUuxCVEAACS+b8NG4WBuA4AxolggwLEgABBABJbcex+egHCcFwDmhWFpDcLYAANSFwAB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6D9kPH4NAJ4fE4SvNOFQs57wLiXM2fcLRyKBlooUmMdA4nOFCI+Y7AAOIUABmAAbGDtUJBhjJAAOyQ6R7QNHaBRCrCWEoAQyp4ckEh2DhgKwhRI7R9DpHSx3tHc+wsWgyQ1QQ6UmgVYDOhRLCR2DuHAg1QMDVMqZUQplRrCR4zsHyR6fc7B7Dmnx3IfKmh5cAQtBodk9oEKBYAgFjJGh6oWHeO0BCjVEjynypSfk+h0sQ3NPacQC++oMiv2yL/djGRYE+ggA= -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Strategy11/formidable-forms&utm_content=2429):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
classes/helpers/FrmFormsHelper.php (1)

290-290: Update the version number in the @SInCE tag.

The @since x.x placeholder should be replaced with the actual version number for this release.

- * @since x.x
+ * @since 6.x.x
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 704fb2a and 813680e.

📒 Files selected for processing (2)
  • classes/helpers/FrmFormsHelper.php (1 hunks)
  • css/custom_theme.css.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
classes/helpers/FrmFormsHelper.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4600)
  • use_wpautop (2343-2349)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Cypress
  • GitHub Check: Run PHP Syntax inspection (8.3)
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (2)
css/custom_theme.css.php (1)

976-983: LGTM! CSS changes properly address message spacing issues.

The margin adjustments for paragraphs within .frm_message containers are well-implemented:

  • Removing bottom margin from all paragraphs prevents excessive spacing
  • Removing top margin from the first paragraph ensures consistent spacing at the message top

These changes work effectively with the conditional autop logic in the PHP helper to provide consistent spacing regardless of whether paragraphs are auto-generated or manually written.

classes/helpers/FrmFormsHelper.php (1)

283-302: Good implementation of conditional autop formatting.

The logic is well-designed:

  • Only applies autop when line breaks are detected in the message
  • Provides flexibility through the frm_wpautop_success_message filter
  • Maintains proper processing order (autop before shortcodes)

This should effectively resolve the spacing issues while maintaining backward compatibility.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 813680e and 2df081e.

📒 Files selected for processing (1)
  • tests/phpunit/forms/test_FrmFormsController.php (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress

Comment thread tests/phpunit/forms/test_FrmFormsController.php Outdated
@Crabcyborg Crabcyborg merged commit 08f597d into master Jul 16, 2025
16 checks passed
@Crabcyborg Crabcyborg deleted the fix_front_end_message_spacing_issues branch July 16, 2025 16:30
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.

1 participant