mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
e866808193
no issue. Only admins and owners should have access to sending emails. Updated relevant templates to restrict access to emails for non-admins/owners
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import Component from '@ember/component';
|
|
import {alias, equal} from '@ember/object/computed';
|
|
import {computed} from '@ember/object';
|
|
import {isBlank} from '@ember/utils';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Component.extend({
|
|
ghostPaths: service(),
|
|
session: service(),
|
|
|
|
tagName: 'li',
|
|
classNames: ['gh-list-row', 'gh-posts-list-item'],
|
|
|
|
post: null,
|
|
|
|
isFeatured: alias('post.featured'),
|
|
isPage: alias('post.page'),
|
|
isDraft: equal('post.status', 'draft'),
|
|
isPublished: equal('post.status', 'published'),
|
|
isScheduled: equal('post.status', 'scheduled'),
|
|
|
|
authorNames: computed('post.authors.[]', function () {
|
|
let authors = this.get('post.authors');
|
|
|
|
return authors.map(author => author.get('name') || author.get('email')).join(', ');
|
|
}),
|
|
|
|
primaryTag: computed('post.authors.[]', function () {
|
|
let primaryTag = this.get('post.tags.firstObject');
|
|
|
|
if (primaryTag) {
|
|
return primaryTag.get('name');
|
|
} else {
|
|
return false;
|
|
}
|
|
}),
|
|
|
|
subText: computed('post.{excerpt,customExcerpt,metaDescription}', function () {
|
|
let text = this.get('post.excerpt') || '';
|
|
let customExcerpt = this.get('post.customExcerpt');
|
|
let metaDescription = this.get('post.metaDescription');
|
|
|
|
if (!isBlank(customExcerpt)) {
|
|
text = customExcerpt;
|
|
} else if (!isBlank(metaDescription)) {
|
|
text = metaDescription;
|
|
}
|
|
|
|
if (this.isScheduled) {
|
|
return `${text.slice(0, 35)}...`;
|
|
} else {
|
|
return `${text.slice(0, 80)}...`;
|
|
}
|
|
})
|
|
});
|