api/graph/events: Fix panic for external participants in SendEmail
Previously, SQL queries in SendEmail would return NULL for participant types other than 'user' or 'email'. This would panic for participant types like 'external' since NULL cannot be scanned to a string, which caused the submitTicket mutation to fail when called with an externalId. Fix by returning and checking for an empty string instead.
This commit is contained in:
parent
65f1cafa0a
commit
5d2deed72a
|
@ -295,12 +295,12 @@ func (builder *EventBuilder) SendEmails(subject string,
|
|||
CASE part.participant_type
|
||||
WHEN 'user' THEN '~' || "user".username
|
||||
WHEN 'email' THEN part.email_name
|
||||
ELSE null END
|
||||
ELSE '' END
|
||||
`, `
|
||||
CASE part.participant_type
|
||||
WHEN 'user' THEN "user".email
|
||||
WHEN 'email' THEN part.email
|
||||
ELSE null END
|
||||
ELSE '' END
|
||||
`).
|
||||
Distinct().
|
||||
From(`event_participant evpart`).
|
||||
|
@ -320,6 +320,9 @@ func (builder *EventBuilder) SendEmails(subject string,
|
|||
if err := rows.Scan(&name, &address); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(name) == 0 || len(address) == 0 {
|
||||
continue
|
||||
}
|
||||
if address == user.Email {
|
||||
if notifySelf {
|
||||
copiedSelf = true
|
||||
|
|
Loading…
Reference in New Issue