diff --git a/changelog/unreleased/fix-ocm-invite-email.md b/changelog/unreleased/fix-ocm-invite-email.md new file mode 100644 index 000000000..1225fa204 --- /dev/null +++ b/changelog/unreleased/fix-ocm-invite-email.md @@ -0,0 +1,5 @@ +Bugfix: Fixed the ocm email template + +The golang conditional construction moved out from the transifex template. + +https://github.com/owncloud/ocis/pull/10030 diff --git a/services/notifications/pkg/email/templates.go b/services/notifications/pkg/email/templates.go index c2c080a96..665b33917 100644 --- a/services/notifications/pkg/email/templates.go +++ b/services/notifications/pkg/email/templates.go @@ -82,11 +82,24 @@ Even though this membership has expired you still might have access through othe Greeting: l10n.Template(`Hi,`), // ScienceMeshInviteTokenGenerated email template, resolves via {{ .MessageBody }} MessageBody: l10n.Template(`{ShareSharer} ({ShareSharerMail}) wants to start sharing collaboration resources with you. -{{if .ShareLink }}To accept the invite, please visit the following URL: +To accept the invite, please visit the following URL: {ShareLink} -Alternatively, you can{{else}} -Please{{end}} visit your federation provider and use the following details: +Alternatively, you can visit your federation provider and use the following details: + Token: {Token} + ProviderDomain: {ProviderDomain}`), + } + + ScienceMeshInviteTokenGeneratedWithoutShareLink = MessageTemplate{ + textTemplate: "templates/text/email.text.tmpl", + htmlTemplate: "templates/html/email.html.tmpl", + // ScienceMeshInviteTokenGeneratedWithoutShareLink email template, Subject field (resolves directly) + Subject: l10n.Template(`ScienceMesh: {InitiatorName} wants to collaborate with you`), + // ScienceMeshInviteTokenGeneratedWithoutShareLink email template, resolves via {{ .Greeting }} + Greeting: l10n.Template(`Hi,`), + // ScienceMeshInviteTokenGeneratedWithoutShareLink email template, resolves via {{ .MessageBody }} + MessageBody: l10n.Template(`{ShareSharer} ({ShareSharerMail}) wants to start sharing collaboration resources with you. +Please visit your federation provider and use the following details: Token: {Token} ProviderDomain: {ProviderDomain}`), } diff --git a/services/notifications/pkg/service/sciencemesh.go b/services/notifications/pkg/service/sciencemesh.go index 356815837..98d01f71a 100644 --- a/services/notifications/pkg/service/sciencemesh.go +++ b/services/notifications/pkg/service/sciencemesh.go @@ -57,8 +57,13 @@ func (s eventsNotifier) handleScienceMeshInviteTokenGenerated(e events.ScienceMe } } + emailTpl := email.ScienceMeshInviteTokenGenerated + if e.InviteLink == "" { + emailTpl = email.ScienceMeshInviteTokenGeneratedWithoutShareLink + } + msg, err := email.RenderEmailTemplate( - email.ScienceMeshInviteTokenGenerated, + emailTpl, s.defaultLanguage, // fixMe: the recipient is unknown, should it be the defaultLocale?, s.defaultLanguage, // fixMe: the defaultLocale is not set by default, shouldn't it be?, s.emailTemplatePath,