1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-posts-list-item.js
Kevin Ansfield a0370eeea5 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(' ');
}
}