-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve email mode messaging (#825)
* feat: update email prevention text and link * feat: add info box when user only has a single email recipient * feat: change update auth method toaster messaging * feat: amend email form discouragement copy * feat: update copy of form de/activation toast
- Loading branch information
Showing
8 changed files
with
63 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,29 +9,32 @@ angular.module('forms').component('formEmailsInputComponent', { | |
saveForm: '&', | ||
}, | ||
controllerAs: 'vm', | ||
controller: formEmailsInputController, | ||
controller: ['$scope', formEmailsInputController], | ||
}) | ||
|
||
function formEmailsInputController() { | ||
function formEmailsInputController($scope) { | ||
const vm = this | ||
vm.validateEmails = (emails) => { | ||
if (!emails) { | ||
vm.emailErrorMsg = | ||
'You must at least enter one email to receive responses' | ||
return | ||
} | ||
|
||
const err = checkForErrors(String(emails).split(',')) | ||
$scope.$watch('vm.formData.emails', (newEmails) => { | ||
vm.emailInfoMsg = | ||
newEmails && String(newEmails).split(',').length === 1 | ||
? 'Recommended: at least 2 recipients to prevent response loss from bounced emails' | ||
: null | ||
}) | ||
|
||
if (err) { | ||
vm.emailErrorMsg = err | ||
vm.formController.emailList.$setValidity('text', false) | ||
} else { | ||
vm.formController.emailList.$setValidity('text', true) | ||
} | ||
vm.validateEmails = (emails) => { | ||
const emailsToCheck = emails ? String(emails).split(',') : undefined | ||
vm.emailErrorMsg = checkForErrors(emailsToCheck) | ||
vm.formController.emailList.$setValidity('text', !vm.emailErrorMsg) | ||
} | ||
|
||
function checkForErrors(emails) { | ||
function checkForErrors(emailsToCheck) { | ||
if (!emailsToCheck) { | ||
return 'You must at least enter one email to receive responses' | ||
} | ||
|
||
const emails = String(emailsToCheck).split(',') | ||
|
||
if (emails.some((email) => isInvalid(email))) { | ||
return 'Please enter valid email(s) (e.g. [email protected]) separated by commas' | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters