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

Rc/location update warnings #35379

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Robert-Costello
Copy link
Contributor

@Robert-Costello Robert-Costello commented Nov 15, 2024

Product Description

⚠️ Adds warnings when editing Web User and Mobile Worker locations. There are two scenarios where a warning will be shown:

  1. When a user (Web or Mobile) is location restricted and is about to have all locations removed.
  2. When the Web User making changes to another user (Web or Mobile) is about to remove the only location shared with the user being edited.

The warning text is specific to the scenario that triggered the warning.
Warnings are read aloud by screen reader if a screen reader is being used.

Screenshot 2024-11-15 at 3 27 24 PM

Technical Summary

Jira Ticket

When making changes to assigned location of location restricted users, the user making the changes can lose access to the user they are editing and the user being edited can lose access to CommCare altogether.

Safety Assurance

Safety story

Tested locally and on staging.

This only handles whether to show a warning depending on the selections made in the UI and does not make any changes to users/location data.

Automated test coverage

QA Plan

no QA planned

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@Robert-Costello Robert-Costello requested review from a team, MartinRiese, AddisonDunn and minhaminha and removed request for a team November 15, 2024 20:41
@Robert-Costello Robert-Costello marked this pull request as ready for review November 15, 2024 20:41
@Robert-Costello
Copy link
Contributor Author

Robert-Costello commented Nov 15, 2024

In the second commit "update page contexts for editing mobile and web users" should have been "update initial page data"
Leaving a comment in lieu of editing the commit.

}
});

const noCommonLocationWarning = $(".no-common-location");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an id would be more appropriate than a class to identify a single element.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, changed here fce3940

return dm.assigned_location_ids;
}
});
let shareLocations = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected can_access_all_locations to be part of this calculation. To me it looks like there are two mechanisms that hide the warning can_access_all_locations for including the divs in the dom and this to hid the divs if they are present. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can_access_all_locations decides whether to include the divs in the dom, that's correct.
shareLocations is updated when the selection changes in the UI before the form is submitted. So if the two users share only one location and the user making the changes removes that location from the dropdown, shareLocations will be set to false and the warning div will be shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants