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

Ticket #2756: Edit member access page - [ZA] #3216

Merged
merged 34 commits into from
Dec 18, 2024

Conversation

zandercymatics
Copy link
Contributor

@zandercymatics zandercymatics commented Dec 11, 2024

Ticket

Resolves #2765

Changes

  • Adds a member edit access page
  • Bug fix for the no domains access page

Context for reviewers

Setup

To test this PR, enable the organization_feature and organization_members flag. On members, click edit on a member.

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 za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@@ -16,7 +18,28 @@ class UserPortfolioRoleChoices(models.TextChoices):

@classmethod
def get_user_portfolio_role_label(cls, user_portfolio_role):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated bug I found in some weird data edge cases. Doesn't hurt to include

return f"Unknown ({user_portfolio_role})"

@classmethod
def get_role_description(cls, user_portfolio_role):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I usually don't like encoding large strings in python like this, but all things considered this seemed like the best spot for this sort of thing as opposed to a squirrelled away html file

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@rachidatecs rachidatecs self-assigned this Dec 17, 2024
Copy link
Contributor

@CocoByte CocoByte left a comment

Choose a reason for hiding this comment

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

Looking through the code...
Overall, nice work! I know we talked through some of the changes in person, but I added a few comments anyways to indicate I am good with alot of the refactoring.

Just a few requests to add code comments.

@@ -4004,6 +4004,10 @@ def changelist_view(self, request, extra_context=None):
if extra_context is None:
extra_context = {}
extra_context["dns_prototype_flag"] = flag_is_active_for_user(request.user, "dns_prototype_flag")
# Normally you have to first enable the org feature then navigate to an org before you see these.
# Lets just auto-populate it on page load to make development easier.
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

populatePermissionDetails('new-member-basic-permissions');
if (selectedAccess && selectedAccess.value === 'organization_admin') {
populatePermissionDetails('member-admin-permissions');
accessText = "Admin"
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this separation of data and display text

@@ -44,5 +36,7 @@ initMembersTable();
initMemberDomainsTable();
initEditMemberDomainsTable();

initPortfolioMemberPageToggle();
// Init the portfolio new member page
initPortfolioMemberPageRadio();
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should start bundling inits()

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree. On a few of the other tickets we have worked on recently, we have consolidated inits to one init per page in the main.js.

@@ -38,21 +38,21 @@ export function hookupYesNoListener(radioButtonName, elementIdToShowIfYes, eleme
**/
export function hookupRadioTogglerListener(radioButtonName, valueToElementMap) {
// Get the radio buttons
let radioButtons = document.querySelectorAll('input[name="'+radioButtonName+'"]');
let radioButtons = document.querySelectorAll(`input[name="${radioButtonName}"]`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice cleanup

return cleaned_data

def map_cleaned_data_to_instance(self, cleaned_data, instance):
Copy link
Contributor

Choose a reason for hiding this comment

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

(Change Request): Can you add more comments here to explain this architecture? I know we went over it, but it can be hard to know at first glance what is going on if you are looking at it for the first time.

@@ -110,7 +110,7 @@ def _get_portfolio_permissions(self):
return self.get_portfolio_permissions(self.roles, self.additional_permissions)

@classmethod
def get_portfolio_permissions(cls, roles, additional_permissions):
def get_portfolio_permissions(cls, roles, additional_permissions, get_list=True):
Copy link
Contributor

Choose a reason for hiding this comment

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

(Change Request): Add comment to quickly describe the usage of get_list

{% endfor %}
</div>
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %}
{% input_with_errors form.role %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely cleaner!

return f"Unknown ({user_portfolio_role})"

@classmethod
def get_role_description(cls, user_portfolio_role):
Copy link
Contributor

Choose a reason for hiding this comment

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

Fair.

<h2>Admin access permissions</h2>
<p>Member permissions available for admin-level acccess.</p>

<h3 class="summary-item__title
text-primary-dark
margin-bottom-0">Organization domain requests</h3>
{% with group_classes="usa-form-editable usa-form-editable--no-border padding-top-0" %}
{% input_with_errors form.admin_org_domain_request_permissions %}
{% input_with_errors form.domain_request_permission_admin %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this name better, too

if form.is_valid():
# Check if user is removing their own admin or edit role
Copy link
Contributor

Choose a reason for hiding this comment

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

Good check

@CocoByte
Copy link
Contributor

@dave-kennedy-ecs, @rachidatecs -- looks like this refactor causes a conflict in the logic for e-mail sending behavior (the ticket you guys are working on). Let Zander and I know if you'd like to huddle on this. I think fundamentally it is just deciding where we want this logic to be and coordinating that part of the code.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Comment on lines -9 to -11
{% block messages %}
{% include "includes/form_messages.html" %}
{% endblock %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixes a bug where messages display twice on this page due to base views implementing this

Copy link

🥳 Successfully deployed to developer sandbox za.

1 similar comment
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

1 similar comment
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

1 similar comment
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link
Contributor

@dave-kennedy-ecs dave-kennedy-ecs left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

🥳 Successfully deployed to developer sandbox za.

@zandercymatics zandercymatics merged commit f475f4a into main Dec 18, 2024
9 of 10 checks passed
@zandercymatics zandercymatics deleted the za/2756-edit-member-access branch December 18, 2024 22:08
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.

Member Profile page: Edit Member Access and Permissions
4 participants