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

#2854 - Org Member Invitation - [NL] #3080

Merged
merged 18 commits into from
Dec 4, 2024
Merged

Conversation

CocoByte
Copy link
Contributor

@CocoByte CocoByte commented Nov 14, 2024

Ticket 2854

Resolves #2854

Changes

  • Added confirmation modal to the Invite Member form
  • Added handlers for submitting form information and writing to the database
  • Added basic unit tests to verify form submission (these tests will need to be updated once e-mail sending function is implemented)

Context for reviewers

Setup

Make sure org model and member waffle flags are on

Code Review Verification Steps

Go to the members table, click "Add a new member". Fill out the form and click "Invite Member". Verify that:

  • A confirmation modal shows that contains all the info you filled out on the form
  • Submitting the modal (clicking "Yes, invite member") submits the form data, redirects to the member table, and writes to the database accordingly. There are three scenarios to test...
    - [ ] Inviting a new user creates a new corresponding Portfolio Invite (that you can view in /admin)
    - [ ] Inviting an already invited user does not write to the database and a message saying the user "has already been invited to this portfolio" displays above the members table after redirect
    - [ ] Inviting a user who is already a portfolio member does not write to the database and a message saying the user "User is already a member of this portfolio." displays above the members table after redirect

Also double-check that:

  • Trying to submit the new member invitation form with errors (blanks or invalid data) does NOT display a modal and instead displays corresponding error messages

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

@CocoByte CocoByte requested a review from abroddrick as a code owner November 14, 2024 17:16
Copy link

🥳 Successfully deployed to developer sandbox nl.

Copy link

🥳 Successfully deployed to developer sandbox nl.

@CocoByte CocoByte changed the title [DRAFT] #2854 - Org Member Invitation #2854 - Org Member Invitation - [NL] Nov 20, 2024
Copy link

🥳 Successfully deployed to developer sandbox nl.

Copy link

🥳 Successfully deployed to developer sandbox nl.

@zandercymatics zandercymatics self-assigned this Nov 21, 2024
Copy link
Contributor

@zandercymatics zandercymatics left a comment

Choose a reason for hiding this comment

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

UI wise, looks great. I like how you are handling things in javascript. One thing I'll note is that Member Access seems to be using the value rather than the display value.

I will note though that submit_new_member can be simplified + cleaned a bit (I've denoted it). Its fine for now since we aren't sending any emails out, but the current structure will cause some side affects once we do
image

src/registrar/views/portfolios.py Show resolved Hide resolved
src/registrar/views/portfolios.py Show resolved Hide resolved
src/registrar/views/portfolios.py Outdated Show resolved Hide resolved
src/registrar/views/portfolios.py Show resolved Hide resolved
<p class="margin-top-0" id="modalEmail"></p>

<h4 class="text-primary">Member Access</h4>
<p class="margin-top-0" id="modalAccessLevel"></p>
Copy link
Contributor

Choose a reason for hiding this comment

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

(nitpick/optional) Maybe better described as modalMemberAccessLevel

src/registrar/assets/js/get-gov.js Outdated Show resolved Hide resolved
src/registrar/assets/js/get-gov.js Outdated Show resolved Hide resolved
src/registrar/assets/js/get-gov.js Outdated Show resolved Hide resolved
src/registrar/assets/js/get-gov.js Outdated Show resolved Hide resolved
@CocoByte CocoByte changed the title #2854 - Org Member Invitation - [NL] #2854 - Org Member Invitation - [AB] Nov 26, 2024
@CocoByte CocoByte changed the title #2854 - Org Member Invitation - [AB] #2854 - Org Member Invitation - [NL] Nov 26, 2024
Copy link

🥳 Successfully deployed to developer sandbox nl.

@CocoByte
Copy link
Contributor Author

CocoByte commented Dec 2, 2024

messages.success(self.request, f"{email} has been invited.")

The UI uses the value because that is what matches the design ACs according to the Figma (they do not want "Basic Access" or "Admin Access"...just "Basic" and "Admin". It's a bit of a shortcut, but I think better than stripping out substrings)

Copy link

github-actions bot commented Dec 3, 2024

🥳 Successfully deployed to developer sandbox nl.

Copy link

github-actions bot commented Dec 3, 2024

🥳 Successfully deployed to developer sandbox nl.

Copy link
Contributor

@zandercymatics zandercymatics left a comment

Choose a reason for hiding this comment

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

See blocking comments before merging but otherwise LGTM on getgov-NL

Comment on lines +537 to +539
if not requestor.is_staff and requestor.email is not None and requestor.email.strip() != "":
requestor_email = requestor.email
elif not requestor.is_staff:
Copy link
Contributor

Choose a reason for hiding this comment

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

(Change before merging) this shouldn't be checking on is_staff since we don't use this anymore, it should instead check on the usergroup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should definitely create a follow-up ticket for this because we are still using .is_staff in alot more places than just this. @abroddrick --tagging you for awareness

src/registrar/views/portfolios.py Outdated Show resolved Hide resolved
except Exception:
logger.error("An error occured")

try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
try:
if not add_success:
return None
try:

missing an early return on not add_success. The above suggestion may have some faulty spacing though just fyi

Comment on lines +588 to +589
if add_success:
messages.success(self.request, f"{email} has been invited.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if add_success:
messages.success(self.request, f"{email} has been invited.")
messages.success(self.request, f"{email} has been invited.")

Not needed if we're doing an early return

src/registrar/views/portfolios.py Show resolved Hide resolved
src/registrar/views/portfolios.py Show resolved Hide resolved
Copy link

github-actions bot commented Dec 4, 2024

🥳 Successfully deployed to developer sandbox nl.

@CocoByte CocoByte merged commit ee4a584 into main Dec 4, 2024
9 of 10 checks passed
@CocoByte CocoByte deleted the nl/2854-org-member-invitation branch December 4, 2024 18:01
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.

Org Member Page - Invite A New Member (INVITATION ONLY)
2 participants