Ghost/ghost/admin/app/components/gh-posts-list-item.js
Kevin Ansfield be0a6d58a0 Improved scheduled status text in posts list
closes https://github.com/TryGhost/Ghost/issues/11965

- fixes scheduled posts always showing "and sent"
- updates status text to match that shown in the editor for scheduled posts
2020-07-01 20:37:46 +01:00

31 lines
894 B
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 scheduledText() {
let {post} = this.args;
let text = [];
if (post.sendEmailWhenPublished) {
let paid = post.visibility === 'paid';
text.push(`and sent to ${paid ? 'paid' : 'all'} members`);
}
let formattedTime = formatPostTime(
post.publishedAtUTC,
{timezone: this.settings.get('timezone'), scheduled: true}
);
text.push(formattedTime);
return text.join(' ');
}
}