Allowed Editor and Author roles to see email options when publishing

no issue

- there are no restrictions on Editor/Author emailing on the API side
- removed `user.canEmail` computed property as it's only contributors that don't have publish/email permissions and they aren't shown the publishing flow anyway
This commit is contained in:
Kevin Ansfield 2022-05-12 12:45:13 +01:00
parent d36517fb1e
commit 4c0c5dcac6
2 changed files with 5 additions and 12 deletions

View File

@ -54,8 +54,6 @@ export default BaseModel.extend(ValidationEngine, {
isAdmin: or('isOwnerOnly', 'isAdminOnly'), isAdmin: or('isOwnerOnly', 'isAdminOnly'),
isAuthorOrContributor: or('isAuthor', 'isContributor'), isAuthorOrContributor: or('isAuthor', 'isContributor'),
canEmail: or('isAdmin', 'isEditor'),
isLoggedIn: computed('id', 'session.user.id', function () { isLoggedIn: computed('id', 'session.user.id', function () {
return this.id === this.get('session.user.id'); return this.id === this.get('session.user.id');
}), }),

View File

@ -108,7 +108,7 @@ export default class PublishOptions {
// publish type dropdown is not shown at all // publish type dropdown is not shown at all
get emailUnavailable() { get emailUnavailable() {
return this.post.isPage || this.post.email || !this.user.canEmail || this.emailDisabledInSettings; return this.post.isPage || this.post.email || this.emailDisabledInSettings;
} }
// publish type dropdown is shown but email options are disabled // publish type dropdown is shown but email options are disabled
@ -252,15 +252,10 @@ export default class PublishOptions {
this.totalMemberCount = 1; this.totalMemberCount = 1;
} }
// only perform limit checks and newsletter fetches if the // email limits
// current user is allowed to email, otherwise we can hit API promises.push(this._checkSendingLimit());
// permission errors // newsletters
if (this.user.canEmail) { promises.push(this.store.query('newsletter', {status: 'active', limit: 'all', include: 'count.members'}));
// email limits
promises.push(this._checkSendingLimit());
// newsletters
promises.push(this.store.query('newsletter', {status: 'active', limit: 'all', include: 'count.members'}));
}
yield Promise.all(promises); yield Promise.all(promises);
} }