-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add banner about updating default email address to email action #2239
base: master
Are you sure you want to change the base?
Add banner about updating default email address to email action #2239
Conversation
Warning Rate limit exceeded@AbdiTolesa has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 5 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThis pull request adds a feature to display a warning regarding potential email delivery issues when the 'To' and 'From' addresses are the same. A new conditional block in the view renders this warning along with buttons for acknowledgment or redirection to the email setup. New CSS rules enhance its visual styling. Additionally, AJAX functionality is implemented—with an action hook, a new controller method, and a corresponding JS event handler—to allow users to dismiss the warning message. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant B as Browser (JS)
participant H as FrmHooksController
participant F as FrmFormsController
U->>B: Clicks dismiss button on email warning
B->>B: Executes handleClickEvent()
B->>+H: Sends AJAX request (frm_dismiss_default_email_message)
H->>+F: Calls dismiss_default_email_message()
F-->>-H: Returns dismiss status (after nonce check and meta update)
H-->>-B: AJAX response received
B->>B: Removes the warning element from the DOM
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (3)
classes/views/frm-form-actions/_action_inside.php (2)
14-14
: Remove empty style attribute.The
<p>
tag contains an empty style attribute that should be removed.- <p class="frm10" style=""> + <p class="frm10">
13-22
: Improve semantic HTML structure and error handling.The notice should use more semantic HTML elements and include error handling for translation functions.
-<div class="frm_grid_container frm_no_p_margin frm_default_email_notice"> - <p class="frm10"> - <b><?php esc_html_e( 'Heads up!', 'formidable' ); ?></b> - <?php esc_html_e( 'Using the same \'To\' and \'From\' email address can sometimes cause delivery issues. We recommend updating your default email addresses to maximize deliverability.', 'formidable' ); ?> - </p> - <p class="frm2"> +<div class="frm_grid_container frm_no_p_margin frm_default_email_notice" role="alert"> + <div class="frm10"> + <h4 class="frm_warning_heading"> + <?php + $heading = esc_html__( 'Heads up!', 'formidable' ); + if ( false === $heading ) { + $heading = 'Heads up!'; // Fallback if translation fails + } + echo $heading; + ?> + </h4> + <?php + $message = esc_html__( 'Using the same \'To\' and \'From\' email address can sometimes cause delivery issues. We recommend updating your default email addresses to maximize deliverability.', 'formidable' ); + if ( false === $message ) { + $message = 'Please update your email settings to ensure proper delivery.'; // Fallback if translation fails + } + echo $message; + ?> + </div> + <div class="frm2">css/frm_admin.css (1)
5447-5451
: Consider adding a hover/focus state for better interactivity.If this notice contains any interactive elements like buttons or links, consider adding hover/focus states to provide visual feedback.
.frm_email_settings .frm_default_email_notice { background-color: var(--primary-25); padding:var(--gap-sm) var(--gap-md); border-radius:var(--small-radius); + transition: background-color 0.2s ease; } +.frm_email_settings .frm_default_email_notice:hover { + background-color: var(--primary-50); +} +.frm_email_settings .frm_default_email_notice:focus-within { + outline: 2px solid var(--primary-500); + outline-offset: 2px; +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
classes/views/frm-form-actions/_action_inside.php
(1 hunks)css/frm_admin.css
(1 hunks)
🔇 Additional comments (4)
classes/views/frm-form-actions/_action_inside.php (2)
10-24
: LGTM! Well-placed notice block.The placement of the email notice block at the beginning of the form action settings is appropriate and follows a logical flow.
19-20
:⚠️ Potential issueAdd click handlers and improve accessibility for buttons.
The buttons have
href="#"
but no JavaScript handlers to process the clicks. Additionally, they need ARIA labels for better accessibility.- <a href="#" class="button frm-button-secondary"><?php esc_html_e( 'Got it', 'formidable' ); ?></a> - <a href="#" class="button frm-button-primary"><?php esc_html_e( 'Setup emails', 'formidable' ); ?></a> + <a href="#" + class="button frm-button-secondary" + onclick="frmDismissEmailNotice(this); return false;" + aria-label="<?php esc_attr_e( 'Dismiss email setup notice', 'formidable' ); ?>"> + <?php esc_html_e( 'Got it', 'formidable' ); ?> + </a> + <a href="#" + class="button frm-button-primary" + onclick="frmShowEmailSetup(this); return false;" + aria-label="<?php esc_attr_e( 'Open email setup configuration', 'formidable' ); ?>"> + <?php esc_html_e( 'Setup emails', 'formidable' ); ?> + </a>Please ensure the JavaScript functions
frmDismissEmailNotice
andfrmShowEmailSetup
are defined in your JS files:css/frm_admin.css (2)
5447-5451
: LGTM! The styling for the default email notice is well-structured.The new CSS rule for
.frm_email_settings .frm_default_email_notice
uses appropriate variables for consistent styling and follows best practices:
- Uses the primary color variable for background
- Applies consistent padding using gap variables
- Uses border-radius variable for rounded corners
5447-5451
: Verify the background color contrast meets accessibility standards.The background color uses
var(--primary-25)
which appears to be a light blue. Let's verify that this provides sufficient contrast with the text color for accessibility.
There was a problem hiding this 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/controllers/FrmFormsController.php (1)
2528-2537
: LGTM! The implementation looks secure and follows WordPress best practices.The function properly verifies the AJAX nonce before updating user meta. However, the
@since
version tag is not defined yet.Update the
@since x.x
version number to the actual version this feature will be released in.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
classes/controllers/FrmFormsController.php
(1 hunks)classes/controllers/FrmHooksController.php
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- classes/controllers/FrmHooksController.php
🔇 Additional comments (1)
classes/controllers/FrmFormsController.php (1)
2549-2576
: LGTM! The validation logic is thorough and handles different action types appropriately.The function properly validates:
- Redirect URLs through the
frm_redirect_url
filter- Page existence and status for page actions
Fix https://github.com/Strategy11/formidable-pro/issues/5453
Design: https://www.figma.com/design/QnMV8Njb7k5hDSdgrvNveY/Form-Actions-(Explorations)?node-id=6-207&t=Y9cwZI7PmScrnuVF-0
Test procedure
Got it
dismisses the banner and it would never be displayed for that user again, even after form reload.Setup emails
redirects user to the email setup page.