Skip to content

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

Closed

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions