-
Notifications
You must be signed in to change notification settings - Fork 806
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
Social: Use core endpoint for dismissing notices #34544
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
projects/packages/publicize/src/jetpack-social-settings/class-dismissed-notices.php
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php
Outdated
Show resolved
Hide resolved
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.
This works well. I just have some optional code suggestions/questions.
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.
Thank you for making the suggested changes. This looks good now.
} ) => { | ||
return ( | ||
return shouldAutoConvert ? null : ( |
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.
Thank you for making this change.
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.
This change was cherry picked in #34730 as a quick fix for the 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.
This tests well, Geri! Requesting @pablinos to glance over it as well to make sure there is nothing glaring.
@@ -62,8 +55,8 @@ public function update_dismissed_notices( $updated, $name, $value ) { | |||
return $updated; | |||
} | |||
|
|||
$notice = $value['notice']; | |||
$reappearance_time = $value['reappearance_time']; | |||
$notice = key( $value ); |
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.
Am I correct in saying that $updated
is true
or false
, $name
is the option name and $value
is ['instagram' => 0]?
If that's the case, $notice
would be instagram
.
reappearance_time
would be $value['notice']
which is 0.
I am bit confused by this change, could you please elaborate why we would need this?
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.
Sure!
The first part of the change (f7eb8bc#diff-b9af7ea1c5d7705e15c3aa19241ee6e3f3b8090af8977a9951def8e88907d2d9R31) is to fix the schema, as the previous one would describe our format poorly. We want the option to store an array with key->value pairs, where the key is the name of the notice, and the value is a numeric value, which is the reappearance time.
The second part (f7eb8bc#diff-5f1e74f983a6c97e6afd793e071e2b976f2f14616174253e77739c59e07de12eR63) was to modify the UI to send the data in this format. That means that for Instagram, it would send jerpack_social_dismissed_notices: { Instagram: 0}
, which means that we want to update the registered setting jerpack_social_dismissed_notices
, with the value of { Instagram: 0}
.
The third part of the change is where your comment lies, where value would be as you said, and the notice variable stores the name, and the reappearance_time is the number. Then we add it to the array $dismissed_notices[ $notice ] = $reappearance_time;
and update the option
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.
Testing it with the API console as in the testing instructions should show if it's working well
This change updates our notice dismissal logic, so it uses
register_setting
and the core endpoint coming with it.We have to support the deprecated Jetpack endpoint, so I flagged that with the current versions so we can get rid of it 3 versions later.
Proposed changes:
Other information:
Jetpack product discussion
https://github.com/orgs/Automattic/projects/733/views/2?pane=issue&itemId=46761193
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
jetpack docker wp option delete jetpack_social_dismissed_notices
Got it
, then refresh the page and select the image again. You should not see the notice anymoreRemove the advanced plan.
jetpack docker wp option get jetpack_social_dismissed_notices
You can also check it from the console: https://developer.wordpress.com/docs/api/console/
Run a query like this with your site ID: