From 5c5e6be47bd8d2be28509c905ee1df795cdcc1e4 Mon Sep 17 00:00:00 2001 From: csmig <33138761+csmig@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:52:48 +0000 Subject: [PATCH] fix: patch of review includes status only (#1230) --- client/src/js/review.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/client/src/js/review.js b/client/src/js/review.js index c092bf54e..b28f3ce81 100644 --- a/client/src/js/review.js +++ b/client/src/js/review.js @@ -1355,40 +1355,36 @@ async function addReview( params ) { try { fp = reviewForm fp.getEl().mask('Saving...') - // masktask = new Ext.util.DelayedTask(function(){ - // Ext.getBody().mask('Saving...') - // }) - // masktask.delay(100) const fvalues = fp.getForm().getFieldValues(false, true) // dirtyOnly=false, getDisabled=true - const jsonData = { - result: fvalues.result, - detail: fvalues.detail, - comment: fvalues.comment, - resultEngine: fp.resultChanged() ? null : fvalues.resultEngine - } - let method + + let method, status switch (saveParams.type) { case 'accept': case 'submit': case 'unsubmit': - jsonData.status = saveParams.type == 'submit' ? 'submitted' : saveParams.type === 'accept' ? 'accepted' : 'saved' + status = saveParams.type == 'submit' ? 'submitted' : saveParams.type === 'accept' ? 'accepted' : 'saved' method = 'PATCH' break + case 'save': case 'save and unsubmit': - jsonData.status = 'saved' + status = 'saved' method = 'PUT' break case 'save and submit': - jsonData.status = 'submitted' - method = 'PUT' - break - case 'save': - jsonData.status = 'saved' + status = 'submitted' method = 'PUT' break } + const jsonData = method === 'PUT' ? { + result: fvalues.result, + detail: fvalues.detail, + comment: fvalues.comment, + resultEngine: fp.resultChanged() ? null : fvalues.resultEngine, + status + } : { status } + const reviewFromApi = await Ext.Ajax.requestPromise({ responseType: 'json', url: `${STIGMAN.Env.apiBase}/collections/${leaf.collectionId}/reviews/${leaf.assetId}/${fp.groupGridRecord.data.ruleId}`,