refs #5929 removed useless vars
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Jorge Penadés 2023-07-26 09:20:54 +02:00
parent 0b6fb70f28
commit a0fee6ad50
8 changed files with 8 additions and 12 deletions

View File

@ -46,7 +46,7 @@ module.exports = Self => {
} }
try { try {
const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
const item = await models.Item.findById(itemId, null, myOptions); const item = await models.Item.findById(itemId, null, myOptions);
const ticket = await models.Ticket.findById(id, { const ticket = await models.Ticket.findById(id, {

View File

@ -115,7 +115,7 @@ module.exports = Self => {
const userId = ctx.req.accessToken.userId; const userId = ctx.req.accessToken.userId;
const models = Self.app.models; const models = Self.app.models;
const $t = ctx.req.__; // $translate const $t = ctx.req.__; // $translate
const isEditable = await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions); await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions);
const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE');
if (!editZone) { if (!editZone) {

View File

@ -70,7 +70,7 @@ module.exports = Self => {
} }
try { try {
const isEditable = await Self.isEditableOrThrow(ctx, args.id, myOptions); await Self.isEditableOrThrow(ctx, args.id, myOptions);
const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE'); const editZone = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'editZone', 'WRITE');
if (!editZone) { if (!editZone) {

View File

@ -32,7 +32,7 @@ module.exports = Self => {
} }
try { try {
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); await Self.isEditableOrThrow(ctx, id, myOptions);
const recalculation = await Self.rawSql('CALL vn.ticket_recalcComponents(?, NULL)', [id], myOptions); const recalculation = await Self.rawSql('CALL vn.ticket_recalcComponents(?, NULL)', [id], myOptions);

View File

@ -39,7 +39,7 @@ module.exports = Self => {
const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions); const ticketToDelete = await models.Ticket.findById(id, {fields: ['isDeleted']}, myOptions);
if (ticketToDelete.isDeleted) return false; if (ticketToDelete.isDeleted) return false;
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); await Self.isEditableOrThrow(ctx, id, myOptions);
// Check if ticket has refunds // Check if ticket has refunds
const ticketRefunds = await models.TicketRefund.find({ const ticketRefunds = await models.TicketRefund.find({

View File

@ -65,13 +65,9 @@ describe('ticket isEditableOrThrow()', () => {
let error; let error;
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 1}}}; const ctx = {req: {accessToken: {userId: 1}}};
const result = await models.Ticket.isEditableOrThrow(ctx, 15, options); await models.Ticket.isEditableOrThrow(ctx, 15, options);
expect(result).toEqual(false);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
error = e; error = e;

View File

@ -28,7 +28,7 @@ module.exports = Self => {
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const isEditable = await Self.isEditableOrThrow(ctx, id, myOptions); await Self.isEditableOrThrow(ctx, id, myOptions);
const ticket = await models.Ticket.findById( const ticket = await models.Ticket.findById(
id, id,

View File

@ -48,7 +48,7 @@ module.exports = Self => {
} }
try { try {
const isEditable = await models.Ticket.isEditableOrThrow(ctx, id, myOptions); await models.Ticket.isEditableOrThrow(ctx, id, myOptions);
if (ticketId) { if (ticketId) {
const isReceiverEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions); const isReceiverEditable = await models.Ticket.isEditable(ctx, ticketId, myOptions);