-
Notifications
You must be signed in to change notification settings - Fork 59
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
Update email when linking respondent #2426
Conversation
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.
Nice work! I've seen this work on your screen and I thought it looked great. But then at first I couldn't get it to work for me. Here's what I tried:
- With the preview build, I went to "Simon Zetterlund" and removed his email. Note that this sets the
email
to an empty string, which is probably the cause of this bug. - I then went to this survey submissions list where there is a submission made using my email address.
- I tried linking the submission to Simon Zetterlund, which works, but the modal does not open.
I then tried creating a new person instead of using an existing one, and not setting an email to begin with, which does work. It probably works because the email will be null
.
I also think that it would be nice to get a designer to look at the modal. Maybe you can just pair up with someone in the office?
Finally, I left a bunch of comments below. The code looks mostly great, but there are some minor things that I think can be improved, and also some that I identified as a learning opportunity – hopefully appreciated. 😊
…se to check person object, change strict operators for non strict, use setDialogPerson for onClose function
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.
Nice work! Let's get this merged. 💯
if (person) { | ||
const personHasNoEmail = person.email == null || person.email == ''; | ||
if (personHasNoEmail && respondentEmail != undefined) { |
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 think this is much nicer! I believe it could have been made even simpler, by relying on the fact that null
and undefined
are falsy, like so:
if (person) { | |
const personHasNoEmail = person.email == null || person.email == ''; | |
if (personHasNoEmail && respondentEmail != undefined) { | |
if (person) { | |
const personHasNoEmail = !person.email || person.email == ''; | |
if (personHasNoEmail && respondentEmail) { |
But that's not worth changing the code over!
Description
This PR adds a dialog to allow the user to add the respondent email to the person that is going to be link as a new respondent.
It also introduces a new extra reducer in the
Survey
store that updates de submission list when a person is updated.Screenshots
Video.sin.titulo.Hecho.con.Clipchamp.1.mp4
Changes
if
statement inSurveySubmissionsList
when a person to be linked as a respondent doesn't have an emailSurveyDialogLink
component to display a Dialog when the if statement is triggeredSurvey
store to update the submissions list whenpersonUpdated
action is triggered.Notes to reviewer
None
Related issues
Resolves #2269