-
Notifications
You must be signed in to change notification settings - Fork 69
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
Allow non-account-owner admin users to submit the payment activity survey #8739
Allow non-account-owner admin users to submit the payment activity survey #8739
Conversation
…ount-owner users to submit survey
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.25 MB ℹ️ View Unchanged
|
…is the Jetpack connection owner
@@ -49,7 +49,7 @@ public function init_hooks() { | |||
* @param array $args - The arguments to passed to Jetpack. | |||
* @param string $body - The body passed on to the HTTP request. | |||
* @param bool $is_site_specific - If true, the site ID will be included in the request url. Defaults to true. | |||
* @param bool $use_user_token - If true, the request will be signed with the user token rather than blog token. Defaults to false. | |||
* @param bool $use_user_token - If true, the request will be signed with the Jetpack connection owner user token rather than blog token. Defaults to false. |
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.
I've added this distinction here, which would have helped me resolve this issue.
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.
Should we change the name of this param? user_token
seems misleading.
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.
Great work @Jinksi. It tested well.
It's a bit hacky to submit the survey as the user who established the Jetpack connection. I was expecting that we can send the request as a blog instead of as a user but maybe the marketing/survey
end-point expects the request to be user-specific.
@shendy-a8c I'm guessing by your approval that you're not too concerned about the hacky-ness of this approach. Do you think we should explore an alternative? I don't see this as a concern, since we are not observing user-specific data (only blogid). |
That's correct. Just an observation that the |
@@ -63,33 +63,42 @@ public function test_empty_rating_returns_400_status_code() { | |||
$this->assertEquals( 400, $response->get_status() ); | |||
} | |||
|
|||
|
|||
public function test_valid_request_forwards_data_to_jetpack() { |
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.
How important and useful is this e2e test, considering that the survey has a limited lifespan?
Fixes #8710
Changes proposed in this Pull Request
This PR allows non-account-owner WP admin users to submit the Payments activity card survey by sending the POST request as the account-owner user.
Account-owner in this context means the WP admin user who set up the WooPayments account and therefore the Jetpack connection.
The (soft) limit for submitting the survey remains once per site (soft, since deleting the WP option
wcpay_survey_payment_overview_submitted
resets this limitation).Testing instructions
wp option update _wcpay_feature_payment_overview_widget 1
in CLI (npm run cli
if docker)wp option delete wcpay_survey_payment_overview_submitted
to clear your local submission state (if survey submitted already).Payments > Overview
.🙌 We appreciate your feedback!
✅Payments > Overview
page and ensure that the survey is not rendered, since it has been submitted.Payments > Overview
.wp option delete wcpay_survey_payment_overview_submitted
to clear your local submission state.Payments > Overview
page and ensure the survey is rendered.🙌 We appreciate your feedback!
✅npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge