Skip to content

Commit

Permalink
fix: patch of review includes status only (#1230)
Browse files Browse the repository at this point in the history
  • Loading branch information
csmig authored Mar 7, 2024
1 parent fefa07a commit 5c5e6be
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions client/src/js/review.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down

0 comments on commit 5c5e6be

Please sign in to comment.