diff --git a/changelog/unreleased/fix-grouped-mail-notifications-empty-body.md b/changelog/unreleased/fix-grouped-mail-notifications-empty-body.md new file mode 100644 index 00000000000..a58e0e2cdfd --- /dev/null +++ b/changelog/unreleased/fix-grouped-mail-notifications-empty-body.md @@ -0,0 +1,3 @@ +Bugfix: Prevent empty email body for grouped email notifications + +https://github.com/owncloud/ocis/pull/10869 diff --git a/services/notifications/pkg/command/send_email.go b/services/notifications/pkg/command/send_email.go index 8da57ce8445..d66af993019 100644 --- a/services/notifications/pkg/command/send_email.go +++ b/services/notifications/pkg/command/send_email.go @@ -1,6 +1,7 @@ package command import ( + "fmt" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/events/stream" "github.com/owncloud/ocis/v2/services/notifications/pkg/config" @@ -51,6 +52,7 @@ func SendEmail(cfg *config.Config) *cli.Command { return err } } + fmt.Println("successfully sent SendEmailsEvent") return nil }, } diff --git a/services/notifications/pkg/service/job.go b/services/notifications/pkg/service/job.go index 56c60d9ebc0..bb087e54a38 100644 --- a/services/notifications/pkg/service/job.go +++ b/services/notifications/pkg/service/job.go @@ -131,6 +131,10 @@ func (s eventsNotifier) createGroupedMail(ctx context.Context, logger zerolog.Lo }) } } + if len(mts) == 0 && len(mtsVars) == 0 { + logger.Error().Msg("no body content for grouped email present") + return + } rendered, err := email.RenderGroupedEmailTemplate(email.Grouped, map[string]string{ "DisplayName": userEvents.User.GetDisplayName(),