0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Improved feature/unfeature choice in post context menu

refs https://github.com/TryGhost/Team/issues/2677
This commit is contained in:
Simon Backx 2023-04-12 15:37:53 +02:00
parent 9eb886d26d
commit 2df049b079

View file

@ -164,18 +164,22 @@ export default class PostsContextMenu extends Component {
}
get shouldFeatureSelection() {
const firstPost = this.selectionList.availableModels[0];
if (!firstPost) {
return true;
let featuredCount = 0;
for (const m of this.selectionList.availableModels) {
if (m.featured) {
featuredCount += 1;
}
}
return !firstPost.featured;
return featuredCount <= this.selectionList.availableModels.length / 2;
}
get canFeatureSelection() {
if (!this.selectionList.isSingle) {
return true;
for (const m of this.selectionList.availableModels) {
if (m.get('status') !== 'sent') {
return true;
}
}
return this.selectionList.availableModels[0]?.get('status') !== 'sent';
return false;
}
get canUnpublishSelection() {