From 22ccb6df03fba0b39a1ba19cd8cbcf8fc77e873a Mon Sep 17 00:00:00 2001 From: thecalcc Date: Mon, 14 Aug 2023 13:12:25 +0300 Subject: [PATCH] Toolbar refactoring improvements --- scripts/api/article.ts | 9 ++++++--- .../authoring-angular-integration.tsx | 20 +++++++++---------- scripts/apps/authoring-react/data-layer.ts | 2 +- .../authoring-react/field-adapters/index.tsx | 4 ++-- .../utilities/compute-editor3-output.ts | 6 ++++-- .../fields/linked-items/index.tsx | 2 +- .../actions/publish-tab.tsx | 6 +----- 7 files changed, 24 insertions(+), 25 deletions(-) diff --git a/scripts/api/article.ts b/scripts/api/article.ts index e3f4907485..6ab5125689 100644 --- a/scripts/api/article.ts +++ b/scripts/api/article.ts @@ -15,7 +15,7 @@ import {IPublishingDateOptions} from 'core/interactive-article-actions-panel/sub import {notify} from 'core/notify/notify'; import ng from 'core/services/ng'; import {gettext} from 'core/utils'; -import {flatMap, keys, pick, trim, union} from 'lodash'; +import {flatMap, keys, pick, trim} from 'lodash'; import {IArticle, IDangerousArticlePatchingOptions, IDesk, IStage, onPublishMiddlewareResult} from 'superdesk-api'; import {duplicateItems} from './article-duplicate'; import {fetchItems, fetchItemsToCurrentDesk} from './article-fetch'; @@ -426,7 +426,10 @@ function edit( function getItemPatchWithKillOrTakedownTemplate(item: IArticle, action: IArticleAction): Promise { const itemForTemplate = { template_name: action, - item: pick(item, union(keys(CONTENT_FIELDS_DEFAULTS), ['_id', 'versioncreated', 'task'])), + item: pick( + item, + [...(keys(CONTENT_FIELDS_DEFAULTS)), '_id', 'versioncreated', 'task'], + ), }; return httpRequestJsonLocal({ @@ -436,7 +439,7 @@ function getItemPatchWithKillOrTakedownTemplate(item: IArticle, action: IArticle }).then((result: IArticle) => { return { ...result, - ...(action === 'kill' && {operation: 'kill'}), + ...(action === 'kill' ? {operation: 'kill'} : {}), state: ITEM_STATE.PUBLISHED, }; }); diff --git a/scripts/apps/authoring-react/authoring-angular-integration.tsx b/scripts/apps/authoring-react/authoring-angular-integration.tsx index e3dc134012..a1cd58f443 100644 --- a/scripts/apps/authoring-react/authoring-angular-integration.tsx +++ b/scripts/apps/authoring-react/authoring-angular-integration.tsx @@ -210,7 +210,7 @@ function getInlineToolbarActions( priority: 0.1, component: () => (