From 79126de8ecb6c7fb9f5e10d3654ecc96e1209bae Mon Sep 17 00:00:00 2001 From: Tobi Ka Date: Fri, 22 Sep 2023 11:20:26 +0200 Subject: [PATCH 1/2] updated mail_data --- dao/event.go | 6 +++--- dao/participation.go | 6 +++--- dao/role.go | 4 ++-- dao/user_active.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dao/event.go b/dao/event.go index c515f3e..a72800b 100644 --- a/dao/event.go +++ b/dao/event.go @@ -296,7 +296,7 @@ func EventParticipantsNotification(ctx context.Context, i *models.Event, templat } for _, participant := range *participants { - mail := vcago.NewMailData(participant.User.Email, "pool-backend", template, participant.User.Country) + mail := vcago.NewMailData(participant.User.Email, "pool-backend", template, "pool", participant.User.Country) mail.AddUser(participant.User.User()) mail.AddContent(participant.ToContent()) vcago.Nats.Publish("system.mail.job", mail) @@ -320,7 +320,7 @@ func EventASPNotification(ctx context.Context, i *models.Event, template string) return } - mail := vcago.NewMailData(user.Email, "pool-backend", template, user.Country) + mail := vcago.NewMailData(user.Email, "pool-backend", template, "pool", user.Country) mail.AddUser(user.User()) mail.AddContent(i.ToContent()) vcago.Nats.Publish("system.mail.job", mail) @@ -343,7 +343,7 @@ func EventStateNotification(ctx context.Context, i *models.Event, template strin return } - mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, eventAps.Country) + mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, "pool", eventAps.Country) mail.AddUser(eventAps.User()) mail.AddContent(i.ToContent()) vcago.Nats.Publish("system.mail.job", mail) diff --git a/dao/participation.go b/dao/participation.go index 425beef..e58f16e 100644 --- a/dao/participation.go +++ b/dao/participation.go @@ -136,7 +136,7 @@ func ParticipationNotification(ctx context.Context, i *models.Participation) (er if i.Status == "rejected" { template = "participation_reject" } - mail := vcago.NewMailData(i.User.Email, "pool-backend", template, i.User.Country) + mail := vcago.NewMailData(i.User.Email, "pool-backend", template, "pool", i.User.Country) mail.AddUser(i.User.User()) mail.AddContent(i.ToContent()) vcago.Nats.Publish("system.mail.job", mail) @@ -154,7 +154,7 @@ func ParticipationCreateNotification(ctx context.Context, i *models.Participatio if eventAps, err = UsersGetByID(ctx, &models.UserParam{ID: i.Event.EventASPID}); err != nil { return } - mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, eventAps.Country) + mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, "pool", eventAps.Country) mail.AddUser(eventAps.User()) mail.AddContent(i.ToContent()) vcago.Nats.Publish("system.mail.job", mail) @@ -172,7 +172,7 @@ func ParticipationWithdrawnNotification(ctx context.Context, i *models.Participa if eventAps, err = UsersGetByID(ctx, &models.UserParam{ID: i.Event.EventASPID}); err != nil { return } - mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, eventAps.Country) + mail := vcago.NewMailData(eventAps.Email, "pool-backend", template, "pool", eventAps.Country) mail.AddUser(eventAps.User()) mail.AddContent(i.ToContent()) vcago.Nats.Publish("system.mail.job", mail) diff --git a/dao/role.go b/dao/role.go index 20690f0..05fe970 100644 --- a/dao/role.go +++ b/dao/role.go @@ -154,7 +154,7 @@ func RoleNotification(ctx context.Context, i map[string]*models.BulkUserRoles) ( ); err != nil { return } - mail := vcago.NewMailData(user.Email, "pool-backend", "role_update", user.Country) + mail := vcago.NewMailData(user.Email, "pool-backend", "role_update", "pool", user.Country) mail.AddUser(user.User()) mail.AddContent(user.RoleContent(role)) vcago.Nats.Publish("system.mail.job", mail) @@ -166,7 +166,7 @@ func RoleAdminNotification(ctx context.Context, crewID *models.CrewParam) (err e crew := new(models.Crew) if err = CrewsCollection.FindOne(ctx, crewID.Match(), crew); err != nil { } - mail := vcago.NewMailData("netzwerk@vivaconagua.org", "pool-backend", "role_network", "de") + mail := vcago.NewMailData("netzwerk@vivaconagua.org", "pool-backend", "role_network", "pool", "de") mail.AddContent(models.RoleAdminContent(crew)) vcago.Nats.Publish("system.mail.job", mail) return diff --git a/dao/user_active.go b/dao/user_active.go index 0474d4f..9597e3b 100644 --- a/dao/user_active.go +++ b/dao/user_active.go @@ -111,7 +111,7 @@ func ActiveNotification(ctx context.Context, i *models.Active, template string) if err = CrewsCollection.FindOne(ctx, bson.D{{Key: "_id", Value: i.CrewID}}, &crew); err != nil { return } - mail := vcago.NewMailData(user.Email, "pool-backend", template, user.Country) + mail := vcago.NewMailData(user.Email, "pool-backend", template, "pool", user.Country) mail.AddUser(user.User()) mail.AddContent(i.ToContent(crew)) vcago.Nats.Publish("system.mail.job", mail) diff --git a/go.mod b/go.mod index cfd081a..c8ecae6 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module pool-backend go 1.17 require ( - github.com/Viva-con-Agua/vcago v1.4.40 + github.com/Viva-con-Agua/vcago v1.4.42 github.com/Viva-con-Agua/vcapool v0.3.4 github.com/google/uuid v1.3.0 github.com/labstack/echo/v4 v4.9.0 diff --git a/go.sum b/go.sum index 62c7916..d836145 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Viva-con-Agua/vcago v1.4.16/go.mod h1:kxaxW9VYWIaCdWoM+PLHNwXmtPj4FPYHPxmPK6JsA1U= -github.com/Viva-con-Agua/vcago v1.4.40 h1:sZiDjbSjSwTUQnKXLdswFl3ybH0upy5u+NIpgkLnz2E= -github.com/Viva-con-Agua/vcago v1.4.40/go.mod h1:uJ7sBZk8IOEJbHgZ97uY+WE6TLMGkhiPvey3CxFOs4A= +github.com/Viva-con-Agua/vcago v1.4.42 h1:+UxsScecaZqEYTNbrUPHxc4Rn/wFJEayxDAjcJjnphU= +github.com/Viva-con-Agua/vcago v1.4.42/go.mod h1:uJ7sBZk8IOEJbHgZ97uY+WE6TLMGkhiPvey3CxFOs4A= github.com/Viva-con-Agua/vcapool v0.3.4 h1:I1IGg7BTfXihMkTwLu+qYygcvfX9zZVMZw9+0B9ZJMs= github.com/Viva-con-Agua/vcapool v0.3.4/go.mod h1:yTwmyj5DbsDduM23aEbK48BW0ONg9092hbmm1HhMso4= github.com/acobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249/go.mod h1:iU1PxQMQwoHZZWmMKrMkrNlY+3+p9vxIjpZOVyxWa0g= From 470e6a79d8ad44c04d508f7ddb66fe3b6e6eab4e Mon Sep 17 00:00:00 2001 From: Tobi Ka Date: Fri, 22 Sep 2023 11:24:35 +0200 Subject: [PATCH 2/2] updated mail_data --- dao/event.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dao/event.go b/dao/event.go index a72800b..28b5189 100644 --- a/dao/event.go +++ b/dao/event.go @@ -300,7 +300,7 @@ func EventParticipantsNotification(ctx context.Context, i *models.Event, templat mail.AddUser(participant.User.User()) mail.AddContent(participant.ToContent()) vcago.Nats.Publish("system.mail.job", mail) - //notification := vcago.NewMNotificationData(participant.User.Email, "pool-backend", template, participant.User.Country, token.ID) + //notification := vcago.NewMNotificationData(participant.User.Email, "pool-backend", template, "pool", participant.User.Country, token.ID) //notification.AddUser(participant.User.User()) //notification.AddContent(participant.ToContent()) //vcago.Nats.Publish("system.notification.job", notification)