Merge "Fix web dequeue of post items"

This commit is contained in:
Zuul 2024-03-19 18:00:48 +00:00 committed by Gerrit Code Review
commit c4d1db0093
1 changed files with 16 additions and 8 deletions

View File

@ -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',
}))
}
}