Skip to content

Notifications: PO file headers appear in translated emails when CallToAction is empty #11908

@snaggo

Description

@snaggo

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

  1. Run OCIS 7.3.1 with notifications enabled
  2. Set the default language to a translated locale, e.g. German or Spanish
  3. Share a file/folder with a user
  4. Remove that share
  5. 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:

Image Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions