2021-05-14 18:01:14 +03:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import {computed} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
|
|
|
const VISIBILITIES = [
|
|
|
|
{label: 'Public', name: 'public'},
|
|
|
|
{label: 'Members only', name: 'members'},
|
|
|
|
{label: 'Paid-members only', name: 'paid'}
|
|
|
|
];
|
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
|
|
|
|
settings: service(),
|
2021-07-02 19:35:10 +03:00
|
|
|
feature: service(),
|
2021-05-14 18:01:14 +03:00
|
|
|
|
|
|
|
// public attrs
|
|
|
|
post: null,
|
|
|
|
|
|
|
|
selectedVisibility: computed('post.visibility', function () {
|
|
|
|
return this.get('post.visibility') || this.settings.get('defaultContentVisibility');
|
|
|
|
}),
|
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
2021-08-23 10:10:59 +03:00
|
|
|
this.availableVisibilities = [...VISIBILITIES];
|
2021-07-02 19:35:10 +03:00
|
|
|
if (this.feature.get('multipleProducts')) {
|
|
|
|
this.availableVisibilities.push(
|
2021-08-20 13:14:37 +03:00
|
|
|
{label: 'Specific tier(s)', name: 'filter'}
|
2021-07-02 19:35:10 +03:00
|
|
|
);
|
|
|
|
}
|
2021-05-14 18:01:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
updateVisibility(newVisibility) {
|
|
|
|
this.post.set('visibility', newVisibility);
|
2021-07-02 19:35:10 +03:00
|
|
|
if (newVisibility !== 'filter') {
|
|
|
|
this.post.set('visibilityFilter', null);
|
|
|
|
}
|
2021-05-14 18:01:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|