-
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
Top Earning Pages widget cannot determine adsense linked status in view-only mode for non-admin user #5493
Comments
@hussain-t the current IB does not satisfy the AC which does not call for hiding the widget on the view only dashboard. The widget should work on the view only dashboard, the main problem here is how a view-only user wouldn't have access to the |
Thanks, @aaemnnosttv. I have updated the IB to have a new REST endpoint to expose the data. Apart from that, we could create a new option for |
@hussain-t I think adding a REST endpoint to return a single boolean is overkill for this situation. Also, the After thinking about this a bit more, I think all we have to do is delay the calling of the We can apply this change only when view-only to preserve the normal behavior for signed in users. If that makes sense and sounds good to you, then let's do that 👍 |
Thanks, @aaemnnosttv, that makes perfect sense 👍 It could be a 3-pointer; however, I have set it to 7 to have more space for testing. We can also add the GFI label to this ticket. |
IB ✅ |
NoteOne little detail that I've discovered while code reviewing the PR for this issue is that in order to replicate the error in the console reported in this issue, the Analytics and Adsense modules need to be shared with a non-administrator role (e.g. |
QA Update ✅
|
Bug Description
When AdSense and Analytics are both connected and shared, and the user is on the view-only Dashboard, the following call to
getAdsenseLinked
results in a console error due to the call to the Analytics settings endpoint not being allowed. This results in the widget rendering normally even when AdSense is not linked.site-kit-wp/assets/js/modules/adsense/components/dashboard/DashboardTopEarningPagesWidget.js
Line 121 in 6874c2e
See #5310 (comment)
Steps to reproduce
Screenshots
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
adsenseLinked
state normally provided on load via the Analytics settings without having access to the module's settingsImplementation Brief
In
assets/js/modules/adsense/components/dashboard/DashboardTopEarningPagesWidget.js
:useSelect
hook that returns thegetAdsenseLinked
selector to return only if the user is not on the view-only dashboard AND thegetReport
call for Analytics is done usinghasFinishedResolution
. In other words, returnundefined
early if the user is on the view-only dashboard AND thegetReport
call for Analytics is still loading; otherwise, return thegetAdsenseLinked
selector.Test Coverage
QA Brief
According to AC the TypeError on the screenshot above should not appear in the DashBoard any more. All functionality should remain the same.
Note for the QA team: One little detail that we've discovered while code reviewing the PR for this issue is that in order to replicate the error in the console reported in this issue, besides the replication steps mentioned in the issue description, the Analytics and Adsense modules need to be shared with a non-administrator role (e.g.
editor
) and the view only dashboard should be accessed with that non-administrator role.Changelog entry
The text was updated successfully, but these errors were encountered: