-
Notifications
You must be signed in to change notification settings - Fork 295
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
Store initial setup time for Site Kit and modules as meta. #6443
Comments
ACs here are good, thanks for including the module setup dates as well 👍🏻 I did add a note to the ACs to use this new selector in the Auto-update logic; I don't think it warrants a new issue 😄 Moved to IB. |
@derweili Can you please add a priority to this issue? Thanks! |
Hey @asvinb, the IB is looking good for the AC, but I have some reservations about the AC itself.
I think this might need to have the AC updated. What's your take on this? |
Do you want me to update the IB or curious to hear @aaemnnosttv 's thoughts about this. |
Thanks @asvinb. I think it might be worth updating the AC, as well as the IB, seeing as we've caught it at this stage. Interested to hear @aaemnnosttv's thoughts too. |
Anything user-specific which isn't critical and 1 hr or less is probably better suited as client-side cache rather than a persistent value in the DB. I wouldn't say this is critical, so if the user were to install SK via WP CLI and this doesn't get set and the user sees it right away instead, that seems fine to me. Moving this back to AC for potential revision. |
@aaemnnosttv, while I think this is a perfectly reasonable statement, when reading the Feature Description for this one it's evident that we currently do make use of the client-side cache for this functionality, but we don't have a very good way of identifying when the site has just been setup on the client side. I think this issue is really about adding some server-side state to make this new-site status more reliable, and we might still be relying on client-side caching to determine whether we'd actually actioned the notification. With that in mind, how do you feel about this one? |
@aaemnnosttv Seems like this one requires your opinion. Do you have time to take a look anytime soon? |
Feature Description
This is a followup for #5853 where showing the auto-update banner is delayed after the initial plugin setup for 10 minutes.
Currently there is no way to get the site kit setup time to calculate the time delta. Therefore the auto-update banner (#5853) tries to recognize the initial setup by verifying URL query params. A cacheItem with a 10 minutes lifetime is used to recognize the initial setup for the following 10 minutes.
There are many assumptions in this process, which are unrelated to the to the actual component.
Therefore it would be better, if the setup time was stored in options and available through the datastore.
The same applies not only to Site Kit setup but also to the setup time of each module.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
core/site
datastore.Implementation Brief
includes/Core/Modules/Modules.php
,activate_module
, update the newly activated module settings by addingsetupTime
with the value set to the current timestamp.$module->get_settings()->merge()
function.includes/Modules/AdSense/Settings.php
, add thesetupTime
to the array of settings within theget_default
function.setupTime
setting for the module on the JS side as well for each module when creating the module store. For e.g inassets/js/modules/adsense/datastore/base.js
.getSetupTime
selector will automatically be available.includes/Core/Authentication/Verification.php
, createincludes/Core/Authentication/SetupTime.php
to add a new optiongooglesitekit_setup_time
and extending theSetting
class instead ofUser_Setting
.includes/Core/Authentication/Clients/OAuth_Client.php
,googlesitekit_setup_time
option value to the current timestamp using the newSetupTime
class, before the user is redirected to thesplash
page, with theauthentication_success
URL param set and there is no redirection url set.includes/Core/Authentication/Authentication.php
,inline_js_base_data
method, addsetupTime
to the returned data, with the value set to a new optiongooglesitekit_setup_time
, which can be obtained by calling$this->options->get
method, passing the option name as parameter.assets/js/googlesitekit/datastore/site/info.js
,RECEIVE_SITE_INFO
reducer, add the newsetupTime
property tositeInfo
.getSetupTime
which returns the above value.assets/js/components/notifications/EnableAutoUpdateBannerNotification.js
,isInitialPluginSetup
to use thegetSetupTime
selector from thecore/site
datastore so that the component is rendered 10 mins after the setup time.Test Coverage
getSetupTime
for both, modules data store and thecore/site
data store.setupTime
options for both, modules and core site options.QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: