Ghost/ghost/admin/app/helpers/full-email-address.js
Kevin Ansfield 1b85b9244b Updated email previews to show full from email address
no issue

- moved duplicated email domain generation from `members-email` controller and `<GhMembersEmailSetting>` to `config.emailDomain`
- added `{{from-email-address emailStr}}` helper that will output the passed in emailStr value if it contains an `@` or concat `emailStr@emailDomain` if it doesn't - lets us use `settings.membersFromAddress` to always get a full email address when it could be just a name (`noreply`) or a full address
- updated customise email and post email preview templates to use the new helper
2021-06-11 16:42:27 +01:00

15 lines
341 B
JavaScript

import Helper from '@ember/component/helper';
import {inject as service} from '@ember/service';
export default class FullEmailAddressHelper extends Helper {
@service config;
compute([email]) {
if (email.indexOf('@') > -1) {
return email;
}
return `${email}@${this.config.emailDomain}`;
}
}