Ghost/ghost/admin/app/components/gh-posts-list-item.js
Rishabh Garg 49b86b466a Allowed sending newsletter to free members only (#1751)
refs 6140a98351

This officially decouples the newsletter recipients from the post visibility allowing us to send emails to free members only.
2020-11-07 00:24:27 +05:30

35 lines
1.0 KiB
JavaScript

import Component from '@glimmer/component';
import {formatPostTime} from 'ghost-admin/helpers/gh-format-post-time';
import {inject as service} from '@ember/service';
export default class GhPostsListItemComponent extends Component {
@service session;
@service settings;
get authorNames() {
return this.args.post.authors.map(author => author.name || author.email).join(', ');
}
get sendEmailWhenPublished() {
let {post} = this.args;
return post.emailRecipientFilter && post.emailRecipientFilter !== 'none';
}
get scheduledText() {
let {post} = this.args;
let text = [];
if (post.emailRecipientFilter && post.emailRecipientFilter !== 'none') {
text.push(`and sent to ${post.emailRecipientFilter} members`);
}
let formattedTime = formatPostTime(
post.publishedAtUTC,
{timezone: this.settings.get('timezone'), scheduled: true}
);
text.push(formattedTime);
return text.join(' ');
}
}