-
Notifications
You must be signed in to change notification settings - Fork 19
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
#3019: Portfolio and domain invitation emails [AD] #3252
Conversation
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't do a full review, just briefly skimmed the code only. No major comments, looks good and I like the implementation, I'll trust Nicolle do the full review though of course as I see she already hit some snags
src/registrar/admin.py
Outdated
if has_errors: | ||
# Re-render the change form if there are errors or warnings | ||
# Prepare context for rendering the change form | ||
opts = self.model._meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non blocking question why "opts"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If confusing, can change. Was modeling code after super class, django.contrib.admin.options.ModelAdmin, in which many of their methods get the options from _meta.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dave-kennedy-ecs It looks like opts
is being used on line 1673 after pulling from obj (its using obj._meta
instead of self.model._meta
). The value for the var definition here is never actually being used, only the _meta property from obj. Seems like a typo and makes it a bit hard to follow -- can you delete the opts definition on this line?
🥳 Successfully deployed to developer sandbox bob. |
@CocoByte @abroddrick I have restaged this PR on AD sandbox. Email sending appears to be broken on BOB sandbox. I have now successfully tested this branch on multiple sandboxes so think the problem is not with the branch, but with the sandbox. Please evaluate the functionality on the AD sandbox, and I have opened a ticket to investigate email sending on BOB sandbox. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still verifying the functionality, but here is the initial code review. Great work! Most of my suggestions are nitpicks so keep that in mind, no need to address everything if you don't view it as worth the time investment
src/registrar/admin.py
Outdated
if has_errors: | ||
# Re-render the change form if there are errors or warnings | ||
# Prepare context for rendering the change form | ||
opts = self.model._meta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dave-kennedy-ecs It looks like opts
is being used on line 1673 after pulling from obj (its using obj._meta
instead of self.model._meta
). The value for the var definition here is never actually being used, only the _meta property from obj. Seems like a typo and makes it a bit hard to follow -- can you delete the opts definition on this line?
common_forbidden_perms = ( | ||
set.intersection(*[set(cls.FORBIDDEN_PORTFOLIO_ROLE_PERMISSIONS.get(role, [])) for role in roles]) | ||
if roles | ||
else set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this check on roles. If you recall, how did you run into this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I had this error when attempting to save a userportfoliopermission through django admin without specifying a role. May have run into it in one of the views though. Can't remember if both scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah weird. Thanks
src/registrar/templates/django/admin/portfolio_invitation_change_form.html
Show resolved
Hide resolved
# COMMENT: this code does not take into account multiple portfolios flag | ||
|
||
# COMMENT: shouldn't this code be based on the organization of the domain, not the org | ||
# of the requestor? requestor could have multiple portfolios |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domain=self.object, | ||
is_member_of_different_org=member_of_different_org, | ||
) | ||
DomainInvitation.objects.get_or_create(email=email, domain=self.object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be create?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be get_or_create to account for an existing, canceled DomainInvitation
🥳 Successfully deployed to developer sandbox bob. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM though note the comments above
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
🥳 Successfully deployed to developer sandbox bob. |
Ticket
Resolves #3019
Changes
Context for reviewers
Setup
Code Review Verification Steps
As the original developer, I have
Satisfied acceptance criteria and met development standards
Ensured code standards are met (Original Developer)
Validated user-facing changes (if applicable)
As a code reviewer, I have
Reviewed, tested, and left feedback about the changes
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.
As a designer reviewer, I have
Verified that the changes match the design intention
Validated user-facing changes as a designer
References
Screenshots