-
Notifications
You must be signed in to change notification settings - Fork 18
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
Issue #1762: Clear warning messages on Contact save #2481
Conversation
🥳 Successfully deployed to developer sandbox bob. |
storage = messages.get_messages(request) | ||
storage.used = False | ||
for message in storage: | ||
if message.level == messages.WARNING: |
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.
(Q) Would we want to use other levels, as well?
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.
Let's not mess with things more than we have to? Just to avoid unwanted and unexpected side effect.
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.
Yeah thats fair, we can always add it later if we need. I suspect we might
def save_model(self, request, obj, form, change): | ||
# Clear warning messages before saving | ||
storage = messages.get_messages(request) | ||
storage.used = False |
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.
Really nice find
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 man, I'll take an approval on this.
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. Confirmed that this bug is reproducible on development, and could not reproduce it on 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!
Ticket
Resolves #1762
Changes
Context for reviewers
Scenario 1: Go to a joined contact change_form, hit save. You are redirected to the change_list and the "joined" warning messages from the contact change form persist on the list view.
Scenario 2 (@Katherine-Osos' scenario): Go a domain request change_form, scroll to a submitter or senior official field that has a multiple object joined contact, click on the little edit icon for that joined contact. A popup window for the contact's change_form appears. Click save. The window disappears. Click save on the request form. You are redirected to the request list and you can see the "joined" warning messages from the contact change_form.
The issue as @zandercymatics suspected is the persistance of DJA messages until they are 'consumed.' To clean up those contextual warning messages that are only needed on the contact change form, we edit the contact save method to clear out any existing warning messages.
Setup
See above scenarios.
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
Ensured code standards are met (Code reviewer)
Validated user-facing changes as a developer
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)
Tested with multiple browsers, the suggestion is to use ones that the developer didn't (check off which ones were used)
(Rarely needed) Tested as both an analyst and applicant user
Note: Multiple code reviewers can share the checklists above, a second reviewers should not make a duplicate checklist
As a designer reviewer, I have
Verified that the changes match the design intention
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)
(Rarely needed) Tested as both an analyst and applicant user
Screenshots