mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 01:42:29 +03:00
7c5b14d050
refs TryGhost/Team#1071 Specific tier visibility for a post was previously stored in `visibility` column directly, which had a limitation of 50 charts. Going forward, for the specific tiers visibility of post/page, we use `tiers` array in API that contains list of tiers with access for post. This change - - replaces `filter` type to `tiers` for visibility - adds new visibility filter segment component in post settings menu which stores array of tiers instead of nql string for visibility - updates serializer and model for post/page - updates tests
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
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(),
|
|
feature: service(),
|
|
|
|
// public attrs
|
|
post: null,
|
|
|
|
selectedVisibility: computed('post.visibility', function () {
|
|
return this.get('post.visibility') || this.settings.get('defaultContentVisibility');
|
|
}),
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
this.availableVisibilities = [...VISIBILITIES];
|
|
if (this.feature.get('multipleProducts')) {
|
|
this.availableVisibilities.push(
|
|
{label: 'Specific tier(s)', name: 'tiers'}
|
|
);
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
updateVisibility(newVisibility) {
|
|
this.post.set('visibility', newVisibility);
|
|
if (newVisibility !== 'tiers') {
|
|
this.post.set('tiers', []);
|
|
}
|
|
}
|
|
}
|
|
});
|