-
Notifications
You must be signed in to change notification settings - Fork 293
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
Rely strictly on AdSense API to determine account status #5183
Comments
Added a QA Brief for this already based on how I encountered this bug. |
@felixarntz I wonder whether we need to save settings after we reset either |
Yes, we do. Would that not be already the case though based on the auto-submission logic from changed settings? |
I don't think so. All |
@eugene-manuilov There is this logic around background submit in AdSense setup, it has been there forever also in the old/current flow. Have you checked that code? We should preferably not call |
Ah.. yes, you are right, @felixarntz. I forgot about that logic. Yes, it will automatically submit changes because the setting is changed. |
Removed unnecessary |
@eugene-manuilov Thanks, 2 more things about the IB:
|
Yes, sounds good to me. Updated. |
IB ✅ |
@felixarntz Matthew has a question regarding QA steps in this comment. Could you please take a look at it and help him since you wrote the original QAB? |
@eugene-manuilov Replied on the PR. |
QA Update:
|
@wpdarren looks like you have the same problem as Matthew had during code review (see here: #5195 (review)). He solved the problem by installing the latest version of the tester plugin. Could you please also confirm that you have the |
@eugene-manuilov yes, I am using the latest version 1.8.2. Let me run through it again and I will let you know if this is still an issue for me. |
QA Update: ❌@eugene-manuilov I am still seeing the issue. I tested it on the previous test site and a new one. It looks like Matthew's issue was to do with
Everything else looks fine. |
@wpdarren Apologies, I think that small but crucial detail about the site status to set in the tester plugin was wrong the way I had originally specified it in the QA Brief. What you're seeing is in fact expected because not having a site takes precedence over some of the other relevant criteria. So I've now updated the QA Brief to have the site status always set to "ready", so that the site status cannot "conflict" with the account status you set here, which is what this issue is exclusively about. |
QA Update: ✅Verified: Ensuring that account is reset
Ensuring the client is reset
|
Follow-up to #4758, #4759, #5106: The logic in the AdSense setup is now generally correct, however there is something we need to enhance: Currently, some of the states are determined based on the
accountID
andclientID
settings, and there are a few situations where we don't update them based on the current API responses. This can lead to inconsistent behavior, especially when mocking different statuses with the tester plugin.It can certainly have real-world implications though too: for example if you first start the AdSense setup with an account that has an AFC client set up but then delete it, when you go back to the AdSense setup, Site Kit still has that old
clientID
set, which is incorrect and leads to the wrong status being set and the wrong UI showing up.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
SetupMain
component:accountID
is set to a non-empty value, the setting should be updated to be an empty string again (in the respectiveuseEffect
).SetupAccount
component:clientID
is set to a non-empty value, the setting should be updated to be an empty string again (in the respectiveuseEffect
).getClients
which is unnecessary. That selector is internally used bygetAFCClient
, and its return value alone is sufficient for any of the conditions where thegetClients
result is currently used (e.g. loading state).Implementation Brief
assets/js/modules/adsense/components/setup/v2/SetupMain.js
:useEffect
hook that sets theaccountID
setting to set an empty string for theaccountID
setting ifaccounts
is an empty array and current value of theaccountID
setting is not empty.site-kit-wp/assets/js/modules/adsense/components/setup/v2/SetupMain.js
Lines 138 to 148 in 00a2fdf
assets/js/modules/adsense/components/setup/v2/SetupAccount.js
:useEffect
hook that sets theclientID
setting to set an empty string for theclientID
setting ifafcClient
isnull
and the current value of theclientID
setting is not empty.site-kit-wp/assets/js/modules/adsense/components/setup/v2/SetupAccount.js
Lines 77 to 81 in 00a2fdf
getClients
selector call and all checks of theclients
variable.Test Coverage
QA Brief
For all tests below: Set the tester plugin AdSense site status to "ready".
Ensure you have at least 1.8.2 of the Tester plugin installed.
Ensuring that account is reset
Ensuring the client is reset
Changelog entry
The text was updated successfully, but these errors were encountered: