Any change to sharing settings triggers sharing notices
See original GitHub issueBug Description
Bug bash issue: https://app.asana.com/0/1202258919887896/1202436389160088 please refer to Asana issue for background
The notice in the bottom of the sharing settings modal is currently being triggered by what seems to be any change to sharing settings. Since the notice is about informing the user that data will be shared through their account, it should probably only be shown under more limited conditions:
- Sharing with additional user roles
- Subtracting roles should not prompt a notice
- Changing sharing management to “All admins” – changing to “Only me” restricts permissions so we don’t need to “warn” the user about it as it doesn’t affect data sharing
- Any change to roles for shared ownership modules which would result in the ownership changing – if the current user is already the owner, it should only show if additional roles are being shared with, as above
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The notice in the footer of the dashboard sharing settings appears only in the following conditions:
- When a module is shared with additional roles;
- When a module sharing management is changed to “All Admins”;
- When a non-owner admin changes module sharing settings for a shared ownership module
- The notice shouldn’t appear when the sharing settings are restricted in any way (a module is shared with less roles or sharing management is changed back to owner only).
Implementation Brief
- In
assets/js/googlesitekit/modules/datastore/sharing-settings.js, create a new selectorhaveSharingSettingsExpandedwith the following changes:- Receives
keyas a required param. - Returns a boolean value, return
falseby default. - Get
sharingSettingsandsavedSharingSettingsfrom the state. - Return
undefinedif either one is not loaded yet. - To compare the
managementchanges, have a condition to check ifkeyis equal tomanagement. - Return
trueif the management setting for any module has been changed fromownertoall_admins. - Similarly, to compare the additional
sharedRoleschanges, have a condition to check ifkeyis equal tosharedRoles. - Return
trueif sharing settings for any module contain roles that haven’t been previously selected.
- Receives
- In
assets/js/components/dashboard-sharing/DashboardSharingSettings/Notice.js: - Using the
haveSharingSettingsExpandedselector, create two calls; one is by passingmanagementas an argument, and the other issharedRoles. - Updated the notice conditions with the above instead of
isEditingManagementandeditingUserRolesSlug. - Remove all the unused code.
- In
assets/js/components/dashboard-sharing/DashboardSharingSettings/constants.js, removeEDITING_MANAGEMENT_KEY. - Remove all the usages for
EDITING_MANAGEMENT_KEYin the DS related components.
Test Coverage
- In
assets/js/components/dashboard-sharing/DashboardSharingSettings/index.test.js, add test cases to cover the above scenarios. - Write unit tests for the new selector
haveSharingSettingsExpanded
QA Brief
- Ensure the Sharing Settings Notice in the footer SHOULD appear after updating a module’s
managementfromownertoall_admins. - Ensure the Sharing Settings Notice in the footer SHOULDN’T appear after updating a module’s
managementfromall_adminstoowner. - Ensure the Sharing Settings Notice in the footer SHOULDN’T appear after removing some of the module’s existing user roles.
- Ensure the Sharing Settings Notice in the footer SHOULDN’T appear after adding back the removed existing role to the module’s user roles.
- Ensure the Sharing Settings Notice in the footer SHOULD appear after adding a new non-existing role to the module’s user roles.
- Ensure the Sharing Settings Notice in the footer SHOULD appear when adding a role when the module’s user roles are empty.
Note: The IB states to add test cases to cover the scenarios; however, the DashboardSharingSettings component isn’t responsible for rendering the Footer component. Rather, DashboardSharingSettingsButton renders the Footer. However, we don’t have tests for that component.
Changelog entry
- Fix conditions for showing the notice in the bottom of the Dashboard Sharing modal when sharing settings are changed.
Issue Analytics
- State:
- Created a year ago
- Comments:8

Top Related StackOverflow Question
@hussain-t, thanks for the initial approach, but I think it would be better if we implement this functionality as a new selector in the sharing settings datastore. We already have original and changed versions of sharing settings in the store state, so we can compare them and find if changes grand access permissions to more users or not. We can call the new selector something like
haveSharingSettingsExpanded. Could you please update the IB, please?@hussain-t I just tweaked one point of the AC specifically around “a shared ownership module”.