ocis
ocis copied to clipboard
Notifications: PO file headers appear in translated emails when CallToAction is empty
Describe the bug
When a notification email template has no CallToAction defined (like ShareRemoved), the mail body contains the PO file headers. This happens in translated languaged like German (de) or Spanish (es), but not in English (en).
Steps to reproduce
- Run OCIS 7.3.1 with notifications enabled
- Set the default language to a translated locale, e.g. German or Spanish
- Share a file/folder with a user
- Remove that share
- The User receives a ShareRemoved email with PO file headers
Expected behavior
The translated message should only contain the subject, greeting and message body. No CallToAction should be shown, and no translation headers should appear like when using en locale.
Actual behavior
The email body contains raw gettext header:
Additional context
Cause (probably):
In services/notifications/pkg/email/composer.go:
mt.CallToAction, err = composeMessage(t.Get(mt.CallToAction), vars)
When mt.CallToAction == "", this becomes t.Get("")
The email template already has {{ if .CallToAction }} so CallToAction is meant to be optional, but the code must not translate empty strings.