Merge pull request 'MASTER_4943-osticket_closeTicket' (!1242) from MASTER_4943-osticket_closeTicket into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1242
This commit is contained in:
Joan Sanchez 2023-01-12 07:41:04 +00:00
commit 7f080241f3
1 changed files with 9 additions and 4 deletions

View File

@ -97,12 +97,17 @@ module.exports = Self => {
async function close(token, secondCookie) {
for (const ticketId of ticketsId) {
try {
const lockCode = await getLockCode(token, secondCookie, ticketId);
const lock = await getLockCode(token, secondCookie, ticketId);
if (!lock.code) {
let error = `Can't get lock code`;
if (lock.msg) error += `: ${lock.msg}`;
throw new Error(error);
}
let form = new FormData();
form.append('__CSRFToken__', token);
form.append('id', ticketId);
form.append('a', config.responseType);
form.append('lockCode', lockCode);
form.append('lockCode', lock.code);
form.append('from_email_id', config.fromEmailId);
form.append('reply-to', config.replyTo);
form.append('cannedResp', 0);
@ -122,7 +127,7 @@ module.exports = Self => {
} catch (e) {
const err = new Error(`${ticketId} Ticket close failed: ${e.message}`);
err.stack += e.stack;
throw err;
console.error(err);
}
}
}
@ -140,7 +145,7 @@ module.exports = Self => {
const body = await response.text();
const json = JSON.parse(body);
return json.code;
return json;
}
};
};