The golang conditional construction moved out from the transifex template

This commit is contained in:
Roman Perekhod
2024-09-12 08:28:26 +02:00
parent b59eaaa13f
commit 0c7bc8a123
3 changed files with 27 additions and 4 deletions

View File

@@ -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

View File

@@ -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}`),
}

View File

@@ -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,