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

#2711: Domain manager view - remove manager when only one manager [BOB] #3388

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dave-kennedy-ecs
Copy link
Contributor

@dave-kennedy-ecs dave-kennedy-ecs commented Jan 22, 2025

Ticket

Resolves #2711

Changes

  • Domain manager 'Remove' button is no longer disabled when there is only one domain manager
  • When there is only one domain manager, and the 'Remove' button is clicked, an error message is returned, reading "Domains must have at least one domain manager."

Context for reviewers

For developers reviewing, I added some notes in the PR where I removed or changed code and why.

Setup

Code Review Verification Steps

As the original developer, I have

Satisfied acceptance criteria and met development standards

  • Met the acceptance criteria, or will meet them in a subsequent PR
  • Created/modified automated tests
  • Update documentation in READMEs and/or onboarding guide

Ensured code standards are met (Original Developer)

  • If any updated dependencies on Pipfile, also update dependencies in requirements.txt.
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values

Validated user-facing changes (if applicable)

  • Tag @dotgov-designers in this PR's Reviewers for design review. If code is not user-facing, delete design reviewer checklist
  • Verify new pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)

As a code reviewer, I have

Reviewed, tested, and left feedback about the changes

  • Pulled this branch locally and tested it
  • Verified code meets all checks above. Address any checks that are not satisfied
  • Reviewed this code and left comments. Indicate if comments must be addressed before code is merged
  • Checked that all code is adequately covered by tests
  • Verify migrations are valid and do not conflict with existing migrations

Validated user-facing changes as a developer

Note: Multiple code reviewers can share the checklists above, a second reviewer should not make a duplicate checklist. All checks should be checked before approving, even those labeled N/A.

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Meets all designs and user flows provided by design/product
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • (Rarely needed) Tested as both an analyst and applicant user

As a designer reviewer, I have

Verified that the changes match the design intention

  • Checked that the design translated visually
  • Checked behavior. Comment any found issues or broken flows.
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links

Validated user-facing changes as a designer

  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • Tested with multiple browsers (check off which ones were used)
    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

References

Screenshots

Copy link

🥳 Successfully deployed to developer sandbox bob.

Copy link

🥳 Successfully deployed to developer sandbox bob.

Copy link

🥳 Successfully deployed to developer sandbox bob.

Copy link

🥳 Successfully deployed to developer sandbox bob.

@@ -1317,6 +1318,57 @@ def test_domain_invitation_flow(self):
home_page = self.app.get(reverse("home"))
self.assertContains(home_page, self.domain.name)

@less_console_noise_decorator
def test_domain_user_role_delete(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No previous tests existed for this view

Comment on lines +1262 to +1263
# Assert that the Cancel link (form) is not displayed
self.assertNotContains(response, f"/invitation/{invitation.id}/cancel")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prior test was not specific enough

Comment on lines -346 to -351
# Check if more than one manager exists on the domain.
# If only one exists, prevent this from happening
has_multiple_managers = len(UserDomainRole.objects.filter(domain=domain_pk)) > 1
if not has_multiple_managers:
return False

Copy link
Contributor Author

@dave-kennedy-ecs dave-kennedy-ecs Jan 23, 2025

Choose a reason for hiding this comment

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

This condition no longer returns a 403 permissions problem, and instead the view handles this and returns a specific error message.

Comment on lines -1077 to -1079
# Add conditionals to the context (such as "can_delete_users")
context = self._add_booleans_to_context(context)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed in context since template is no longer disabling button based on context values this method was adding

Copy link

🥳 Successfully deployed to developer sandbox bob.

@@ -69,7 +69,6 @@ <h2 class> Domain managers </h2>
</th>
{% if not portfolio %}<td data-label="Role">{{ item.permission.role|title }}</td>{% endif %}
<td>
{% if can_delete_users %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

conditional now obsolete

Comment on lines -115 to -126
{% else %}
<input
type="submit"
class="usa-button--unstyled disabled-button usa-tooltip usa-tooltip--registrar"
value="Remove"
data-position="bottom"
title="Domains must have at least one domain manager"
data-tooltip="true"
aria-disabled="true"
role="button"
>
{% endif %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer need to present disabled button under any conditions

@dave-kennedy-ecs dave-kennedy-ecs changed the title [DRAFT] #2711: Bob/2711 domain mgr remove [BOB] #2711: Domain manager view - remove manager when only one manager [BOB] Jan 23, 2025
@dave-kennedy-ecs dave-kennedy-ecs requested a review from a team January 23, 2025 17:35
@gabydisarli gabydisarli requested review from gabydisarli and removed request for a team January 24, 2025 20:37
@gabydisarli
Copy link
Contributor

Hi Dave! Can you change the screen reader output on the Remove button to include the email of the domain manager being removed like "Remove "

Copy link

🥳 Successfully deployed to developer sandbox bob.

@dave-kennedy-ecs
Copy link
Contributor Author

Hi Dave! Can you change the screen reader output on the Remove button to include the email of the domain manager being removed like "Remove "

Yes. I set the aria-label to "Remove {{email}}" on the Remove link.

@gabydisarli
Copy link
Contributor

I'm just realizing I didn't quite update the alert message and it said the same thing as org model, which doesn't make sense. Can you update the message to say:

Domains must have one domain manager. To remove yourself, the domain needs another domain manager.

Also, can you match the usual margin we have when alerts stack between the error alert that appears and the info alert below it

Copy link

🥳 Successfully deployed to developer sandbox bob.

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.

Change pattern on removing domain managers from tooltip to alert
2 participants