Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
fc9b9eb718
|
@ -23,21 +23,23 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.sendCheckingPresence = async(ctx, workerId, message) => {
|
Self.sendCheckingPresence = async(ctx, recipientId, message) => {
|
||||||
if (!workerId) return false;
|
if (!recipientId) return false;
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const account = await models.Account.findById(workerId);
|
const account = await models.Account.findById(recipientId);
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
|
||||||
|
if (recipientId == userId) return false;
|
||||||
|
|
||||||
if (!account)
|
if (!account)
|
||||||
throw new Error(`Could not send message "${message}" to worker id ${workerId} from user ${userId}`);
|
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||||
|
|
||||||
const query = `SELECT worker_isWorking(?) isWorking`;
|
const query = `SELECT worker_isWorking(?) isWorking`;
|
||||||
const [result] = await Self.rawSql(query, [workerId]);
|
const [result] = await Self.rawSql(query, [recipientId]);
|
||||||
|
|
||||||
if (!result.isWorking) {
|
if (!result.isWorking) {
|
||||||
const workerDepartment = await models.WorkerDepartment.findById(workerId, {
|
const workerDepartment = await models.WorkerDepartment.findById(recipientId, {
|
||||||
include: {
|
include: {
|
||||||
relation: 'department'
|
relation: 'department'
|
||||||
}
|
}
|
||||||
|
@ -46,7 +48,7 @@ module.exports = Self => {
|
||||||
const channelName = department && department.chatName;
|
const channelName = department && department.chatName;
|
||||||
|
|
||||||
if (channelName)
|
if (channelName)
|
||||||
return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`);
|
return Self.send(ctx, `#${channelName}`, `@${account.name} ➔ ${message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Self.send(ctx, `@${account.name}`, message);
|
return Self.send(ctx, `@${account.name}`, message);
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe('chat sendCheckingPresence()', () => {
|
||||||
|
|
||||||
expect(response.statusCode).toEqual(200);
|
expect(response.statusCode).toEqual(200);
|
||||||
expect(response.message).toEqual('Fake notification sent');
|
expect(response.message).toEqual('Fake notification sent');
|
||||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym => I changed something');
|
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym ➔ I changed something');
|
||||||
|
|
||||||
// restores
|
// restores
|
||||||
await department.updateAttribute('chatName', null);
|
await department.updateAttribute('chatName', null);
|
||||||
|
|
|
@ -72,5 +72,13 @@
|
||||||
"Deleted absence": "The worker <strong>{{author}}</strong> has deleted an absence of type '{{absenceType}}' to <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> for day {{dated}}.",
|
"Deleted absence": "The worker <strong>{{author}}</strong> has deleted an absence of type '{{absenceType}}' to <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> for day {{dated}}.",
|
||||||
"I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})",
|
"I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})",
|
||||||
"I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})",
|
"I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})",
|
||||||
"Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): ```{{{changes}}}```"
|
"Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
|
"agencyModeFk": "Agency",
|
||||||
|
"clientFk": "Client",
|
||||||
|
"zoneFk": "Zone",
|
||||||
|
"warehouseFk": "Warehouse",
|
||||||
|
"shipped": "Shipped",
|
||||||
|
"landed": "Landed",
|
||||||
|
"addressFk": "Address",
|
||||||
|
"companyFk": "Company"
|
||||||
}
|
}
|
|
@ -121,11 +121,11 @@
|
||||||
"Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
|
"Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
|
||||||
"Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
|
"Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
|
||||||
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
|
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
|
||||||
"MESSAGE_BOUGHT_UNITS": "Se ha comprado {{quantity}} unidades de {{concept}} (#{{itemId}}) para el ticket id [{{ticketId}}]({{{url}}})",
|
"MESSAGE_BOUGHT_UNITS": "Se ha comprado {{quantity}} unidades de {{concept}} ({{itemId}}) para el ticket id [{{ticketId}}]({{{url}}})",
|
||||||
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} (#{{clientId}})]({{{url}}}) a *{{credit}} €*",
|
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
|
||||||
"MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} (#{{clientId}})]({{{url}}})",
|
"MESSAGE_CHANGED_PAYMETHOD": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
||||||
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} (#{{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Claim will be picked": "Se recogerá el género de la reclamación (#{{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
|
"Claim will be picked": "Se recogerá el género de la reclamación ({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
|
||||||
"This ticket is not an stowaway anymore": "El ticket id [{{ticketId}}]({{{ticketUrl}}}) ha dejado de ser un polizón",
|
"This ticket is not an stowaway anymore": "El ticket id [{{ticketId}}]({{{ticketUrl}}}) ha dejado de ser un polizón",
|
||||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||||
|
@ -140,7 +140,6 @@
|
||||||
"Role already assigned": "Role already assigned",
|
"Role already assigned": "Role already assigned",
|
||||||
"Invalid role name": "Invalid role name",
|
"Invalid role name": "Invalid role name",
|
||||||
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
"Role name must be written in camelCase": "Role name must be written in camelCase",
|
||||||
"can't be set": "can't be set",
|
|
||||||
"Email already exists": "Email already exists",
|
"Email already exists": "Email already exists",
|
||||||
"User already exists": "User already exists",
|
"User already exists": "User already exists",
|
||||||
"Absence change notification on the labour calendar": "Notificacion de cambio de ausencia en el calendario laboral",
|
"Absence change notification on the labour calendar": "Notificacion de cambio de ausencia en el calendario laboral",
|
||||||
|
@ -149,5 +148,13 @@
|
||||||
"I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
|
"I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
|
||||||
"I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
|
"I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
|
||||||
"You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
|
"You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
|
||||||
"Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): ```{{{changes}}}```"
|
"Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
|
"agencyModeFk": "Agencia",
|
||||||
|
"clientFk": "Cliente",
|
||||||
|
"zoneFk": "Zona",
|
||||||
|
"warehouseFk": "Almacén",
|
||||||
|
"shipped": "F. envío",
|
||||||
|
"landed": "F. entrega",
|
||||||
|
"addressFk": "Consignatario",
|
||||||
|
"companyFk": "Empresa"
|
||||||
}
|
}
|
|
@ -103,7 +103,7 @@ module.exports = Self => {
|
||||||
delete updatedTicket.ctx;
|
delete updatedTicket.ctx;
|
||||||
delete updatedTicket.option;
|
delete updatedTicket.option;
|
||||||
|
|
||||||
// Force unroute
|
// Force to unroute ticket
|
||||||
const hasToBeUnrouted = true;
|
const hasToBeUnrouted = true;
|
||||||
const changedProperties = diff(originalTicket, updatedTicket);
|
const changedProperties = diff(originalTicket, updatedTicket);
|
||||||
|
|
||||||
|
@ -140,6 +140,7 @@ module.exports = Self => {
|
||||||
let changesMade = '';
|
let changesMade = '';
|
||||||
for (let change in changedProperties) {
|
for (let change in changedProperties) {
|
||||||
let value = changedProperties[change];
|
let value = changedProperties[change];
|
||||||
|
let oldValue = originalTicket[change];
|
||||||
if (value instanceof Date) {
|
if (value instanceof Date) {
|
||||||
value = new Intl.DateTimeFormat('es', {
|
value = new Intl.DateTimeFormat('es', {
|
||||||
year: '2-digit',
|
year: '2-digit',
|
||||||
|
@ -151,7 +152,18 @@ module.exports = Self => {
|
||||||
}).format(value);
|
}).format(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
changesMade += `${change}: ${value}\r\n`;
|
if (oldValue instanceof Date) {
|
||||||
|
oldValue = new Intl.DateTimeFormat('es', {
|
||||||
|
year: '2-digit',
|
||||||
|
month: '2-digit',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
second: '2-digit'
|
||||||
|
}).format(oldValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
changesMade += `\r\n~${$t(change)}: ${oldValue}~ ➔ *${$t(change)}: ${value}*`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = $t('Changed this data from the ticket', {
|
const message = $t('Changed this data from the ticket', {
|
||||||
|
|
|
@ -50,8 +50,8 @@ describe('ticket componentUpdate()', () => {
|
||||||
req: {
|
req: {
|
||||||
accessToken: {userId: userID},
|
accessToken: {userId: userID},
|
||||||
headers: {origin: 'http://localhost'},
|
headers: {origin: 'http://localhost'},
|
||||||
__: (value, params) => {
|
__: value => {
|
||||||
return params.nickname;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue