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
Peter Zimon 175e022634 Updated email role restrictions
no issue.
Only admins and owners should have access to sending emails. Updated relevant templates
to restrict access to emails for non-admins/owners
2019-11-26 13:20:49 +01:00

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)}...`;
}
})
});