From a546778fb60a2e30e94680f0d1f179c44a22ce25 Mon Sep 17 00:00:00 2001 From: Decker Dominik Date: Mon, 16 Dec 2024 19:26:37 +0100 Subject: [PATCH] SUP-17899: Fixed time-management opening from edit-mode --- .../entries/2024/12/8090.SUP-17899.bugfix | 1 + .../content-frame/content-frame.component.ts | 34 +++++++++++-------- .../time-management-modal.component.ts | 10 ++++-- 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 cms-oss-changelog/src/changelog/entries/2024/12/8090.SUP-17899.bugfix diff --git a/cms-oss-changelog/src/changelog/entries/2024/12/8090.SUP-17899.bugfix b/cms-oss-changelog/src/changelog/entries/2024/12/8090.SUP-17899.bugfix new file mode 100644 index 000000000..35e5823ca --- /dev/null +++ b/cms-oss-changelog/src/changelog/entries/2024/12/8090.SUP-17899.bugfix @@ -0,0 +1 @@ +Editor User Interface: Fixed an issue when attempting to opening the time-management from a page when in edit- or preview-mode. diff --git a/cms-ui/apps/editor-ui/src/app/content-frame/components/content-frame/content-frame.component.ts b/cms-ui/apps/editor-ui/src/app/content-frame/components/content-frame/content-frame.component.ts index 25f244d54..48d4a573d 100644 --- a/cms-ui/apps/editor-ui/src/app/content-frame/components/content-frame/content-frame.component.ts +++ b/cms-ui/apps/editor-ui/src/app/content-frame/components/content-frame/content-frame.component.ts @@ -1010,8 +1010,13 @@ ins.gtx-diff { // if page has timemanagement set or timemanagement setting request in queue so that publishing it would override those settings if ((PublishableStateUtil.statePlanned(page) && PublishableStateUtil.statePlannedOnline(page)) || PublishableStateUtil.stateInQueue(page)) { // The modal will handle refreshing the item list and closing the editor. - publishReq = this.modalService.fromComponent(PublishTimeManagedPagesModal, {}, { pages: [ page ], allPages: 1, closeEditor }) + publishReq = this.modalService.fromComponent( + PublishTimeManagedPagesModal, + {}, + { pages: [ page ], allPages: 1, closeEditor }, + ) .then(modal => modal.open()) + .catch(err => this.errorHandler.catch(err)); } else { publishReq = this.folderActions.publishPages([ page ]) .then(() => { @@ -1251,23 +1256,22 @@ ins.gtx-diff { } promise.then(result => { - if (typeof result !== 'boolean') { + if (typeof result !== 'boolean' || !result) { return; } - setTimeout(() => { - this.modalService.fromComponent(TimeManagementModal, {}, { item, currentNodeId: this.currentNode.id }) - .then(modal => modal.open()) - .then(() => { - // prevent ConfirmNavigationModal pop up a second time triggered by route guard when TimeManagementModal closes editor - this.contentModified = false; - this.markContentAsModifiedInState(false); - // refresh folder content list to display new TimeManagement settings - this.folderActions.refreshList('page'); - // then close content frame - this.navigationService.instruction({ detail: null }).navigate(); - }); - }, 1); + this.modalService.fromComponent(TimeManagementModal, {}, { item, currentNodeId: this.currentNode.id }) + .then(modal => modal.open()) + .then(() => { + // prevent ConfirmNavigationModal pop up a second time triggered by route guard when TimeManagementModal closes editor + this.contentModified = false; + this.markContentAsModifiedInState(false); + // refresh folder content list to display new TimeManagement settings + this.folderActions.refreshList('page'); + // then close content frame + this.navigationService.instruction({ detail: null }).navigate(); + }) + .catch(err => this.errorHandler.catch(err)); }); } diff --git a/cms-ui/apps/editor-ui/src/app/shared/components/time-management-modal/time-management-modal.component.ts b/cms-ui/apps/editor-ui/src/app/shared/components/time-management-modal/time-management-modal.component.ts index 9ec51dd39..0dde90f50 100644 --- a/cms-ui/apps/editor-ui/src/app/shared/components/time-management-modal/time-management-modal.component.ts +++ b/cms-ui/apps/editor-ui/src/app/shared/components/time-management-modal/time-management-modal.component.ts @@ -115,8 +115,14 @@ export class TimeManagementModal extends BaseModal implements On if (this.item.languageVariants && Object.keys(this.item.languageVariants).length > 0) { // eslint-disable-next-line guard-for-in for (const key in this.item.languageVariants) { - const pageID = this.item.languageVariants[key]; - this.folderActions.getPage(pageID as number) + let pageID = this.item.languageVariants[key]; + if (pageID == null) { + continue; + } else if (typeof pageID === 'object') { + pageID = pageID.id; + } + + this.folderActions.getPage(pageID) .then(page => { this.itemsToBeModified.push(page); });