From c92b2c2221f2d7326898abf9b8ca9aaddb36c91c Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 15 Mar 2024 07:37:24 -0700 Subject: [PATCH] Fix web dequeue of post items This is a partial revert of 6c1c91f8ba6305f7c742133ca99bc0253ea6774f which relied on change.id being absent in the case that a queue item was for a non-change ref; however, all queue items have an id. This reverts that section of code back to the previous regex-based heuristic. Change-Id: I07ff7c2925b44a7e85529491755b2f3d3f73eaf8 --- web/src/containers/status/Item.jsx | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/web/src/containers/status/Item.jsx b/web/src/containers/status/Item.jsx index 65bceb0b6e..dcde9778c4 100644 --- a/web/src/containers/status/Item.jsx +++ b/web/src/containers/status/Item.jsx @@ -75,7 +75,16 @@ class Item extends React.Component { let refRef = ref.ref this.setState(() => ({ showDequeueModal: false })) // post-merge - if (refId !== 'N/A') { + if (/^[0-9a-f]{40}$/.test(refId)) { + dequeue_ref(tenant.apiPrefix, projectName, pipeline.name, refRef) + .then(() => { + this.props.dispatch(fetchStatusIfNeeded(tenant)) + }) + .catch(error => { + this.props.dispatch(addDequeueError(error)) + }) + // pre-merge, ie we have a change id + } else if (refId !== 'N/A') { dequeue(tenant.apiPrefix, projectName, pipeline.name, refId) .then(() => { this.props.dispatch(fetchStatusIfNeeded(tenant)) @@ -84,13 +93,12 @@ class Item extends React.Component { this.props.dispatch(addDequeueError(error)) }) } else { - dequeue_ref(tenant.apiPrefix, projectName, pipeline.name, refRef) - .then(() => { - this.props.dispatch(fetchStatusIfNeeded(tenant)) - }) - .catch(error => { - this.props.dispatch(addDequeueError(error)) - }) + this.props.dispatch(addNotification({ + url: null, + status: 'Invalid change ' + refRef + ' on project ' + projectName, + text: '', + type: 'error', + })) } }