-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #219: send event state change also to event creator if not iden…
…tical to asp
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,6 +212,7 @@ func EventUpdate(ctx context.Context, i *models.EventUpdate, token *models.Acces | |
if result.EventState.State == "published" || | ||
result.EventState.State == "canceled" || | ||
(result.EventState.State == "requested" && result.EventState.CrewConfirmation == "") { | ||
EventStateNotificationCreator(result) | ||
EventStateNotification(ctx, result) | ||
} | ||
} else if event.StartAt != result.StartAt || | ||
|
@@ -446,6 +447,25 @@ func EventStateNotification(ctx context.Context, i *models.Event) (err error) { | |
return | ||
} | ||
|
||
func EventStateNotificationCreator(i *models.Event) (err error) { | ||
|
||
// if event_asp is creator -> stop. | ||
if i.EventASPID == i.Creator.ID { | ||
return | ||
} | ||
|
||
template := "event_state" | ||
mail := vcago.NewMailData(i.Creator.Email, "pool-backend", template, "pool", i.Creator.Country) | ||
mail.AddUser(i.Creator) | ||
mail.AddContent(i.ToContent()) | ||
vcago.Nats.Publish("system.mail.job", mail) | ||
//notification := vcago.NewMNotificationData(user.Email, "pool-backend", template, user.Country, token.ID) | ||
//notification.AddUser(user.User()) | ||
//notification.AddContent(i.ToContent()) | ||
//vcago.Nats.Publish("system.notification.job", notification) | ||
return | ||
} | ||
|
||
func EventHistoryAdminNotification(ctx context.Context, data []models.EventStateHistoryNotification) (err error) { | ||
mail := vcago.NewMailData("[email protected]", "pool-backend", "events_published", "pool", "de") | ||
mail.AddContent(models.EventHistoryAdminContent(data)) | ||
|