Skip to content

Commit

Permalink
The golang conditional construction moved out from the transifex temp…
Browse files Browse the repository at this point in the history
…late
  • Loading branch information
2403905 committed Sep 12, 2024
1 parent b59eaaa commit 0c7bc8a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-ocm-invite-email.md
Original file line number Diff line number Diff line change
@@ -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
19 changes: 16 additions & 3 deletions services/notifications/pkg/email/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
}
Expand Down
7 changes: 6 additions & 1 deletion services/notifications/pkg/service/sciencemesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0c7bc8a

Please sign in to comment.