Skip to content

Commit

Permalink
Fixes #219: send event state change also to event creator if not iden…
Browse files Browse the repository at this point in the history
…tical to asp
  • Loading branch information
ebroda committed Nov 25, 2024
1 parent 23724b6 commit 03bffe6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dao/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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)

Check failure on line 459 in dao/event.go

View workflow job for this annotation

GitHub Actions / check-run

cannot use i.Creator (variable of type models.User) as *vmod.User value in argument to mail.AddUser
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))
Expand Down

0 comments on commit 03bffe6

Please sign in to comment.