mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
f559170a39
closes https://github.com/TryGhost/Team/issues/1584 refs https://github.com/TryGhost/Team/issues/1605 - added email limit check to PublishOptions setup - moved email disabled messaging from the email recipients option to the publish type option - it was confusing to have the email publish type options disabled without any indication of why, with the message hidden within the closed email recipients option
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import {PublishOptions} from '../components/editor-labs/publish-management';
|
|
import {Resource} from 'ember-could-get-used-to-this';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class PublishOptionsResource extends Resource {
|
|
@service config;
|
|
@service limit;
|
|
@service session;
|
|
@service settings;
|
|
@service store;
|
|
|
|
@tracked publishOptions;
|
|
|
|
get value() {
|
|
return this.publishOptions;
|
|
}
|
|
|
|
setup() {
|
|
const post = this.args.positional[0];
|
|
this._post = post;
|
|
|
|
this.publishOptions = this._createPublishOptions(post);
|
|
}
|
|
|
|
update() {
|
|
// required due to a weird invalidation issue when using Ember Data with ember-could-get-used-to-this
|
|
// TODO: re-test after upgrading to ember-resources
|
|
const post = this.args.positional[0];
|
|
if (post !== this._post) {
|
|
this.publishOptions = this._createPublishOptions(post);
|
|
}
|
|
}
|
|
|
|
_createPublishOptions(post) {
|
|
const {config, limit, settings, store} = this;
|
|
|
|
return new PublishOptions({
|
|
config,
|
|
limit,
|
|
post,
|
|
settings,
|
|
store,
|
|
user: this.session.user
|
|
});
|
|
}
|
|
}
|