diff --git a/dao/event.go b/dao/event.go index 4a90af1..e88a162 100644 --- a/dao/event.go +++ b/dao/event.go @@ -435,34 +435,30 @@ func EventStateNotification(ctx context.Context, i *models.Event) (err error) { return } + notifyAboutStateChange(eventAps, i) + return +} + +func notifyAboutStateChange(notifyUser *models.User, i *models.Event) { template := "event_state" - mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, "pool", eventAps.Country) - mail.AddUser(eventAps.User()) + mail := vcago.NewMailData(notifyUser.Email, "pool-backend", template, "pool", notifyUser.Country) + mail.AddUser(notifyUser.User()) 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 := vcago.NewMNotificationData(notifyUser.Email, "pool-backend", template, notifyUser.Country, token.ID) + //notification.AddUser(notifyUser.User()) //notification.AddContent(i.ToContent()) //vcago.Nats.Publish("system.notification.job", notification) - 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) + notifyAboutStateChange(i.Creator, i) return }