0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Removed feature action from context menu for email-only posts (#16606)

These posts make no sense to be featured, so we are removing the option
from the context menu when there is only a single email-only post under
selection.

We still allow featuring these posts in the PSM and when they are
part of a larger selection, but fixing all places for this is out of
scope atm.
This commit is contained in:
Fabien 'egg' O'Carroll 2023-04-11 13:25:49 +07:00 committed by GitHub
parent 7a800ec06e
commit d4fe7217d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View file

@ -11,18 +11,20 @@
<span>Unpublish</span>
</button>
</li>
{{#if this.shouldFeatureSelection }}
<li>
<button class="mr2" type="button" {{on "click" this.featurePosts}}>
<span>Feature</span>
</button>
</li>
{{else}}
{{#if this.canFeatureSelection}}
{{#if this.shouldFeatureSelection }}
<li>
<button class="mr2" type="button" {{on "click" this.unfeaturePosts}}>
<span>Unfeature</span>
</button>
</li>
<button class="mr2" type="button" {{on "click" this.featurePosts}}>
<span>Feature</span>
</button>
</li>
{{else}}
<li>
<button class="mr2" type="button" {{on "click" this.unfeaturePosts}}>
<span>Unfeature</span>
</button>
</li>
{{/if}}
{{/if}}
<li>
<button class="mr2" type="button" disabled {{on "click" @menu.close}}>

View file

@ -42,6 +42,13 @@ export default class PostsContextMenu extends Component {
return !firstPost.featured;
}
get canFeatureSelection() {
if (!this.selectionList.isSingle) {
return true;
}
return this.selectionList.availableModels[0].get('status') !== 'sent';
}
@action
async featurePosts() {
const updatedModels = this.selectionList.availableModels;