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