From 76fae2a724db9fcfca88a9f91cc39c20f937e4a2 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Thu, 13 Apr 2023 16:20:58 +0200 Subject: [PATCH] Fixed unpublishing sent posts was allowed refs https://github.com/TryGhost/Team/issues/2677 --- ghost/admin/app/components/posts-list/context-menu.js | 4 ++-- ghost/posts-service/lib/PostsService.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ghost/admin/app/components/posts-list/context-menu.js b/ghost/admin/app/components/posts-list/context-menu.js index 0aa61ebee8..7639a34348 100644 --- a/ghost/admin/app/components/posts-list/context-menu.js +++ b/ghost/admin/app/components/posts-list/context-menu.js @@ -169,7 +169,7 @@ export default class PostsContextMenu extends Component { // Update the models on the client side for (const post of updatedModels) { - if (post.status === 'published' || post.status === 'sent') { + if (post.status === 'published') { // We need to do it this way to prevent marking the model as dirty this.store.push({ data: { @@ -329,7 +329,7 @@ export default class PostsContextMenu extends Component { get canUnpublishSelection() { for (const m of this.selectionList.availableModels) { - if (['published', 'sent'].includes(m.status)) { + if (m.status === 'published') { return true; } } diff --git a/ghost/posts-service/lib/PostsService.js b/ghost/posts-service/lib/PostsService.js index c57fa7b0cc..6aa37780f3 100644 --- a/ghost/posts-service/lib/PostsService.js +++ b/ghost/posts-service/lib/PostsService.js @@ -69,7 +69,7 @@ class PostsService { async bulkEdit(data, options) { if (data.action === 'unpublish') { - return await this.#updatePosts({status: 'draft'}, {filter: this.#mergeFilters('status:[published,sent]', options.filter)}); + return await this.#updatePosts({status: 'draft'}, {filter: this.#mergeFilters('status:published', options.filter)}); } if (data.action === 'feature') { return await this.#updatePosts({featured: true}, {filter: options.filter});