Skip to content
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

Implement new selector for shared ownership modules #4791

Closed
aaemnnosttv opened this issue Feb 4, 2022 · 2 comments
Closed

Implement new selector for shared ownership modules #4791

aaemnnosttv opened this issue Feb 4, 2022 · 2 comments
Labels
P0 High priority Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature

Comments

@aaemnnosttv
Copy link
Collaborator

aaemnnosttv commented Feb 4, 2022

Feature Description

Related to shared ownership modules (see #4790), the core/modules store will be extended to make these modules selectable.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • A new getSharedOwnershipModules selector should be added to the core/modules store which should return a list of module objects (the shared ownership modules)
    • This selector should have a resolver which receives the list of shared ownership modules from the dashboard sharing data global if they haven't been received yet
  • A new receiveSharedOwnershipModules action should be added for storing the given list of module slugs in the store's state for use by the selector
  • Appropriate test coverage should be added for each

Implementation Brief

  • In assets/js/googlesitekit/modules/datastore/modules.js,

  • Create a resolver generator function (method) *getSharedOwnershipModules() with the following:

    • Call getSharedOwnershipModules() selector and return early if the selector returns non-undefined value.
    • Destructure sharedOwnershipModules from global._googlesitekitDashboardSharing.
    • Dispatch receiveSharedOwnershipModules action to set sharedOwnershipModules in the state.
  • Create an action method receiveSharedOwnershipModules() with the following:

    • It should accept a parameter sharedOwnershipModules and it should set it in the state as state.sharedOwnershipModules.
    • Add sharedOwnershipModules in the baseInitialState and set undefined as the default value.
  • Create RECEIVE_SHARED_OWNERSHIP_MODULES case in the baseReducer with the following:

    • Get sharedOwnershipModules from the payload.
    • Return sharedOwnershipModules along with the state.
  • Create getSharedOwnershipModules() selector with the following:

    • Get the modules from the getModules selector.
    • Return undefined if the getModules selector is not yet loaded.
    • Return undefined if the sharedOwnershipModules is undefined in the state.
    • It should return the modules object that maps/matches the sharedOwnershipModules from the state.

Test Coverage

  • Add test cases for getSharedOwnershipModules selector and receiveSharedOwnershipModules action

QA Brief

QA
This isn't QA-able directly in the plugin yet. For now, QA here can be a simple regression test with and without dashboard sharing enabled.

QA:Eng

  • Ensure the dashboardSharing feature flag is enabled.
  • In the console, run googlesitekit.data.select('core/modules').getSharedOwnershipModules()
  • Ensure it returns the expected modules.
  • Disable the dashboardSharing feature flag and run googlesitekit.data.select('core/modules').getSharedOwnershipModules()
  • Ensure it returns undefined and the console error Could not load core/modules dashboard sharing.

Changelog entry

  • Implement new selector for shared ownership modules.
@aaemnnosttv aaemnnosttv added P0 High priority Type: Enhancement Improvement of an existing feature labels Feb 4, 2022
@felixarntz felixarntz removed their assignment Feb 4, 2022
@jimmymadon jimmymadon self-assigned this Feb 5, 2022
@hussain-t hussain-t assigned hussain-t and unassigned jimmymadon and hussain-t Apr 20, 2022
@eugene-manuilov eugene-manuilov self-assigned this Apr 22, 2022
@eugene-manuilov
Copy link
Collaborator

IB ✅

@eugene-manuilov eugene-manuilov removed their assignment Apr 22, 2022
@hussain-t hussain-t self-assigned this Apr 22, 2022
@hussain-t hussain-t removed their assignment May 19, 2022
@eugene-manuilov eugene-manuilov removed their assignment May 19, 2022
@eclarke1 eclarke1 added the Rollover Issues which role over to the next sprint label May 23, 2022
@wpdarren wpdarren self-assigned this May 26, 2022
@wpdarren
Copy link
Collaborator

QA Update: ✅

Verified:

With dashboardSharing feature flag enabled:

  • When I run googlesitekit.data.select('core/modules').getSharedOwnershipModules() in the console, it returns the expected modules. PSI and Idea Hub

With dashboardSharing disabled:

  • When I run googlesitekit.data.select('core/modules').getSharedOwnershipModules() it returns undefined and the console error Could not load core/modules dashboard sharing.
Screenshots

image
image

@wpdarren wpdarren removed their assignment May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Rollover Issues which role over to the next sprint Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

7 participants