Conversation
|
Warning Rate limit exceeded
⌛ 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. 📝 WalkthroughWalkthroughThis PR removes the activation-time admin redirect flag and relocates the PayButton Public Key UI and save flow from the Paywall Settings to a new dedicated Settings page, refactoring admin form handling accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@includes/class-paybutton-admin.php`:
- Around line 109-122: The handler block that verifies paybutton_settings_save
and updates the option uses $_POST['paybutton_public_key'] unconditionally,
which can produce notices or save an empty value; before calling
sanitize_text_field and update_option('paybutton_public_key', ...), check that
isset($_POST['paybutton_public_key']) and that the sanitized value is not empty
(short-circuit/return early or add an admin error notice) after the nonce
(wp_verify_nonce) and capability (current_user_can) checks; ensure you reference
the same request keys (paybutton_public_key, paybutton_settings_nonce) and only
call update_option when the value is present and non-empty.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@includes/class-paybutton-admin.php`:
- Line 299: The current assignment for 'settings_saved' uses
isset($_GET['settings-updated']) which treats both settings-updated=true and
settings-updated=false as success; change the check to compare the query value
strictly to the string 'true' (i.e., $_GET['settings-updated'] === 'true') so
the 'settings_saved' flag only becomes true on an explicit successful redirect;
update the 'settings_saved' array entry (in the class handling admin notices
where 'settings_saved' is set) to use that strict comparison, matching the other
handlers that already use === 'true'.
🧹 Nitpick comments (1)
includes/class-paybutton-admin.php (1)
119-124: Consider adding an admin notice for validation failure.The empty key check correctly prevents saving, but the redirect with
settings-updated=falsedoesn't inform the user why the save failed. Consider adding a transient-based error message or query parameter to display a specific notice.💡 Suggested improvement
if ( empty( $_POST['paybutton_public_key'] ) ) { + set_transient( 'paybutton_settings_error', 'Public key cannot be empty.', 30 ); wp_safe_redirect( - admin_url( 'admin.php?page=paybutton-settings&settings-updated=false' ) + admin_url( 'admin.php?page=paybutton-settings&settings-updated=error' ) ); exit; }Then in
settings_page(), check for the transient and display the error.
This PR implements #117.
Test Plan:
Summary by CodeRabbit
New Features
Changes