Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7460] Forms Engine - Content locked after cancelling form with changes #4212

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions static-assets/components/cstudio-forms/forms-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ const initializeCStudioForms = () => {
}
};

var unlockBeforeCancel = function (path) {
var unlockBeforeCancel = function (path, onCancel) {
CStudioAuthoring.Service.lookupContentItem(CStudioAuthoringContext.site, path, {
success: function (itemTO) {
//Unlock if the item is locked by the user
Expand All @@ -1762,13 +1762,15 @@ const initializeCStudioForms = () => {
eventNS.oldPath = null;
getTopLegacyWindow().document.dispatchEvent(eventNS);
var editorId = CStudioAuthoring.Utils.getQueryVariable(location.search, 'editorId');
onCancel?.();
CStudioAuthoring.InContextEdit.unstackDialog(editorId);
},
failure: function () {}
});
} else {
_notifyServer = false;
var editorId = CStudioAuthoring.Utils.getQueryVariable(location.search, 'editorId');
onCancel?.();
CStudioAuthoring.InContextEdit.unstackDialog(editorId);
}
},
Expand Down Expand Up @@ -1816,19 +1818,23 @@ const initializeCStudioForms = () => {
CStudioAuthoring.Utils.showConfirmDialog({
body: message,
onOk: () => {
if (iceWindowCallback && iceWindowCallback.cancelled) {
iceWindowCallback.cancelled();
}
sendMessage({ type: FORM_CANCEL });
var entityId = buildEntityIdFn(null);
showWarnMsg = false;

var path = CStudioAuthoring.Utils.getQueryVariable(location.search, 'path');
if (path && path.indexOf('.xml') != -1) {
unlockBeforeCancel(path);
unlockBeforeCancel(path, () => {
if (iceWindowCallback && iceWindowCallback.cancelled) {
iceWindowCallback.cancelled();
}
});
} else {
_notifyServer = false;
var editorId = CStudioAuthoring.Utils.getQueryVariable(location.search, 'editorId');
if (iceWindowCallback && iceWindowCallback.cancelled) {
iceWindowCallback.cancelled();
}
CStudioAuthoring.InContextEdit.unstackDialog(editorId);

if (path == '/site/components/page') {
Expand Down