fix error sending notification when field is not defined
This commit is contained in:
parent
99fe3d2fe0
commit
30c2bc9c05
@ -26,6 +26,8 @@ Template for next version
|
||||
|
||||
### Fixed
|
||||
|
||||
- error sending notification when field is not defined (https://github.com/ohmyform/ohmyform/issues/161)
|
||||
|
||||
### Security
|
||||
|
||||
## [1.0.1] - 2022-03-01
|
||||
|
||||
@ -25,12 +25,12 @@ export class SubmissionNotificationService {
|
||||
try {
|
||||
const to = this.getEmail(
|
||||
submission,
|
||||
notification.toField.id,
|
||||
notification.toField?.id,
|
||||
notification.toEmail
|
||||
)
|
||||
const from = this.getEmail(
|
||||
submission,
|
||||
notification.fromField.id,
|
||||
notification.fromField?.id,
|
||||
notification.fromEmail
|
||||
)
|
||||
|
||||
@ -73,6 +73,10 @@ export class SubmissionNotificationService {
|
||||
}
|
||||
|
||||
private getEmail(submission: SubmissionEntity, fieldId: number, fallback: string): string {
|
||||
if (!fieldId) {
|
||||
return fallback
|
||||
}
|
||||
|
||||
const data = submission.fields.find(field => field.fieldId === fieldId)?.content
|
||||
|
||||
if (!data) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user