From 7f89899d6c0097bba33e19250f1952268c2bd0dc Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 23 Nov 2022 12:54:52 +0100 Subject: [PATCH 1/6] fix: closeTicket --- db/changes/{10491-august => 10503-november}/00-osTicketConfig.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{10491-august => 10503-november}/00-osTicketConfig.sql (100%) diff --git a/db/changes/10491-august/00-osTicketConfig.sql b/db/changes/10503-november/00-osTicketConfig.sql similarity index 100% rename from db/changes/10491-august/00-osTicketConfig.sql rename to db/changes/10503-november/00-osTicketConfig.sql From 4e7ef47b88827fad6f881212618e9546dd013682 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Nov 2022 07:41:08 +0100 Subject: [PATCH 2/6] SQL fixes --- .../{00-greuge.userFK_userFk.sql => 00-greuge.sql} | 0 db/changes/10503-november/00-update-client-invoiceE.sql | 3 --- 2 files changed, 3 deletions(-) rename db/changes/10503-november/{00-greuge.userFK_userFk.sql => 00-greuge.sql} (100%) delete mode 100644 db/changes/10503-november/00-update-client-invoiceE.sql diff --git a/db/changes/10503-november/00-greuge.userFK_userFk.sql b/db/changes/10503-november/00-greuge.sql similarity index 100% rename from db/changes/10503-november/00-greuge.userFK_userFk.sql rename to db/changes/10503-november/00-greuge.sql diff --git a/db/changes/10503-november/00-update-client-invoiceE.sql b/db/changes/10503-november/00-update-client-invoiceE.sql deleted file mode 100644 index 16e7c076d..000000000 --- a/db/changes/10503-november/00-update-client-invoiceE.sql +++ /dev/null @@ -1,3 +0,0 @@ -UPDATE `vn`.`client` -set hasElectronicInvoice = TRUE -where buisnessTypeFk = 'officialOrganism' \ No newline at end of file From 92557ea22d635fa7399367cb7bb7cb365a4adbe5 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Nov 2022 07:43:34 +0100 Subject: [PATCH 3/6] Added version 10510 --- db/changes/10510-december/deleteMe.keep | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/changes/10510-december/deleteMe.keep diff --git a/db/changes/10510-december/deleteMe.keep b/db/changes/10510-december/deleteMe.keep new file mode 100644 index 000000000..7a4187c02 --- /dev/null +++ b/db/changes/10510-december/deleteMe.keep @@ -0,0 +1 @@ +Delete this file From 866ee4d565b3a6f88b2db0e0e699132b37375990 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Nov 2022 08:36:29 +0100 Subject: [PATCH 4/6] fix(rocketchat): Replace invalid link characters --- back/models/chat.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/back/models/chat.js b/back/models/chat.js index 95a1e2c29..19f73ca4a 100644 --- a/back/models/chat.js +++ b/back/models/chat.js @@ -4,4 +4,21 @@ module.exports = Self => { require('../methods/chat/sendCheckingPresence')(Self); require('../methods/chat/notifyIssues')(Self); require('../methods/chat/sendQueued')(Self); + + Self.observe('before save', async function(ctx) { + if (!ctx.isNewInstance) return; + + let {message} = ctx.instance; + if (!message) return; + + const parts = message.match(/(?<=\[)[A-Za-z0-9()*\s]*(?=])/g) || []; + const replacedParts = parts.map(part => { + return part.replace(/[*()]/g, ''); + }); + + for (const [index, part] of parts.entries()) + message = message.replace(part, replacedParts[index]); + + ctx.instance.message = message; + }); }; From db64ba48fc21ff4939b6f895dd67a56c70949ab2 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Nov 2022 08:45:26 +0100 Subject: [PATCH 5/6] fix(rocketchat): Removed parenthesis --- back/methods/chat/notifyIssues.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/back/methods/chat/notifyIssues.js b/back/methods/chat/notifyIssues.js index 902ee59cd..3c4706d07 100644 --- a/back/methods/chat/notifyIssues.js +++ b/back/methods/chat/notifyIssues.js @@ -32,7 +32,7 @@ module.exports = Self => { let message = $t(`There's a new urgent ticket:`); const ostUri = 'https://cau.verdnatura.es/scp/tickets.php?id='; tickets.forEach(ticket => { - message += `\r\n[ID: *${ticket.number}* - ${ticket.subject} (@${ticket.username})](${ostUri + ticket.id})`; + message += `\r\n[ID: *${ticket.number}* - ${ticket.subject} @${ticket.username}](${ostUri + ticket.id})`; }); const department = await models.Department.findOne({ @@ -42,7 +42,5 @@ module.exports = Self => { if (channelName) return Self.send(ctx, `#${channelName}`, `@all ➔ ${message}`); - - return; }; }; From 7ea4d9c2e18df2b64326d138837a33f7a9543b37 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Nov 2022 09:18:21 +0100 Subject: [PATCH 6/6] fix(rocketchat): Regex fix --- back/models/chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/models/chat.js b/back/models/chat.js index 19f73ca4a..f45d15180 100644 --- a/back/models/chat.js +++ b/back/models/chat.js @@ -11,7 +11,7 @@ module.exports = Self => { let {message} = ctx.instance; if (!message) return; - const parts = message.match(/(?<=\[)[A-Za-z0-9()*\s]*(?=])/g) || []; + const parts = message.match(/(?<=\[).*(?=])/g); const replacedParts = parts.map(part => { return part.replace(/[*()]/g, ''); });