From 3be6a23d58b4756b85c59e5d5b7806be364e42ba Mon Sep 17 00:00:00 2001 From: devketanpro Date: Fri, 30 Dec 2022 15:10:47 +0530 Subject: [PATCH 1/4] Fix:Locked items in package widget cannot be opened [SDESK-6706] --- scripts/apps/authoring/packages/packages.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/apps/authoring/packages/packages.ts b/scripts/apps/authoring/packages/packages.ts index df3a2fc5c4..52940ed416 100644 --- a/scripts/apps/authoring/packages/packages.ts +++ b/scripts/apps/authoring/packages/packages.ts @@ -29,7 +29,9 @@ function PackagesCtrl($scope, superdesk, api, search) { if (packageItem._type === 'published') { superdesk.intent('view', 'item', packageItem); } else { - superdesk.intent('edit', 'item', packageItem); + superdesk.intent('edit', 'item', packageItem).then(null, () => { + superdesk.intent('view', 'item', packageItem); + }); } }; From 7b876224772848ebe73e17cb70cf6edcf26154a9 Mon Sep 17 00:00:00 2001 From: devketanpro Date: Thu, 5 Jan 2023 13:30:35 +0530 Subject: [PATCH 2/4] Address the comment --- scripts/apps/authoring/authoring/index.ts | 4 ++-- scripts/apps/authoring/packages/packages.ts | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/apps/authoring/authoring/index.ts b/scripts/apps/authoring/authoring/index.ts index db7fc8d05c..4123d455d2 100644 --- a/scripts/apps/authoring/authoring/index.ts +++ b/scripts/apps/authoring/authoring/index.ts @@ -216,8 +216,8 @@ angular.module('superdesk.apps.authoring', [ {action: 'list', type: 'archive'}, {action: 'edit', type: 'item'}, ], - additionalCondition: ['authoring', 'item', function(authoring, item) { - return authoring.itemActions(item).edit; + additionalCondition: ['authoring', 'item', async function(authoring, item) { + return await authoring.itemActions(item).edit; }], }) .activity('edit.item.popup', { diff --git a/scripts/apps/authoring/packages/packages.ts b/scripts/apps/authoring/packages/packages.ts index 52940ed416..df3a2fc5c4 100644 --- a/scripts/apps/authoring/packages/packages.ts +++ b/scripts/apps/authoring/packages/packages.ts @@ -29,9 +29,7 @@ function PackagesCtrl($scope, superdesk, api, search) { if (packageItem._type === 'published') { superdesk.intent('view', 'item', packageItem); } else { - superdesk.intent('edit', 'item', packageItem).then(null, () => { - superdesk.intent('view', 'item', packageItem); - }); + superdesk.intent('edit', 'item', packageItem); } }; From 55c8a37b8797fb1552c5f6ae833cbd52c6199fa3 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Thu, 5 Jan 2023 16:22:30 +0100 Subject: [PATCH 3/4] itemActions is synchronous --- scripts/apps/authoring/authoring/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/apps/authoring/authoring/index.ts b/scripts/apps/authoring/authoring/index.ts index 4123d455d2..db7fc8d05c 100644 --- a/scripts/apps/authoring/authoring/index.ts +++ b/scripts/apps/authoring/authoring/index.ts @@ -216,8 +216,8 @@ angular.module('superdesk.apps.authoring', [ {action: 'list', type: 'archive'}, {action: 'edit', type: 'item'}, ], - additionalCondition: ['authoring', 'item', async function(authoring, item) { - return await authoring.itemActions(item).edit; + additionalCondition: ['authoring', 'item', function(authoring, item) { + return authoring.itemActions(item).edit; }], }) .activity('edit.item.popup', { From c52b7c8775a561d1c946e28431085699064d6dc5 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Thu, 5 Jan 2023 16:22:42 +0100 Subject: [PATCH 4/4] use openArticle --- scripts/apps/authoring/packages/packages.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/apps/authoring/packages/packages.ts b/scripts/apps/authoring/packages/packages.ts index df3a2fc5c4..aa33212a16 100644 --- a/scripts/apps/authoring/packages/packages.ts +++ b/scripts/apps/authoring/packages/packages.ts @@ -1,5 +1,6 @@ import _ from 'lodash'; import {gettext} from 'core/utils'; +import {openArticle} from 'core/get-superdesk-api-implementation'; PackagesCtrl.$inject = ['$scope', 'superdesk', 'api', 'search']; function PackagesCtrl($scope, superdesk, api, search) { @@ -27,9 +28,9 @@ function PackagesCtrl($scope, superdesk, api, search) { $scope.openPackage = function(packageItem) { if (packageItem._type === 'published') { - superdesk.intent('view', 'item', packageItem); + openArticle(packageItem._id, 'view'); } else { - superdesk.intent('edit', 'item', packageItem); + openArticle(packageItem._id, 'edit'); } };