remove(console.log): se quitan console.log que se utilizaron para dbuggear refs #5979
gitea/salix/pipeline/head Build queued... Details

This commit is contained in:
Pablo Natek 2023-10-19 08:40:25 +02:00
parent 488181e1b6
commit f8889df903
4 changed files with 0 additions and 22 deletions

View File

@ -25,16 +25,10 @@ module.exports = Self => {
});
Self.sendCheckingPresence = async(ctx, recipientId, message) => {
console.log('recipientId: ', recipientId);
if (!recipientId) return false;
const models = Self.app.models;
console.log('sender: ', ctx.req.accessToken.userId);
const sender = ctx.req.accessToken.userId;
console.log('sender: ', sender);
const recipient = recipientId;
console.log('recipient: ', recipient);
console.log('recipientId == sender: ', recipientId == sender);
// Prevent sending messages to yourself
if (recipientId == sender) return false;
@ -42,7 +36,6 @@ module.exports = Self => {
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${sender}`);
if (process.env.NODE_ENV == 'test')
message = `[Test:Environment to user ${sender}] ` + message;
console.log('chat create');
const chat = await models.Chat.create({
senderFk: sender.id,
recipient: `@${recipient.name}`,
@ -53,8 +46,6 @@ module.exports = Self => {
attempts: 0
});
console.log('chat: ');
try {
await Self.sendCheckingUserStatus(chat);
await Self.updateChat(chat, 'sent');

View File

@ -19,14 +19,12 @@ module.exports = Self => {
}
});
Self.getUrl = async(appName = 'salix') => {
console.log('appName: ', appName);
const {url} = await Self.app.models.Url.findOne({
where: {
appName,
enviroment: process.env.NODE_ENV || 'development'
}
});
console.log('url: ', url);
return url;
};
};

View File

@ -6,26 +6,18 @@ module.exports = Self => {
require('../methods/chat/sendQueued')(Self);
Self.observe('before save', async function(ctx) {
console.log('chat start 1');
console.log('ctx.isNewInstance: ', ctx.isNewInstance);
console.log('message: ', ctx.instance);
if (!ctx.isNewInstance) return;
let {message} = ctx.instance;
if (!message) return;
const parts = message.match(/(?<=\[)[a-zA-Z0-9_\-+!@#$%^&*()={};':"\\|,.<>/?\s]*(?=])/g);
if (!parts) return;
console.log('chat start 2');
const replacedParts = parts.map(part => {
return part.replace(/[!$%^&*()={};':"\\,.<>/?]/g, '');
});
console.log('chat start 3');
for (const [index, part] of parts.entries())
message = message.replace(part, replacedParts[index]);
ctx.instance.message = message;
console.log('chat end');
});
};

View File

@ -136,9 +136,6 @@ module.exports = Self => {
clientName: claim.client().name,
claimUrl: `${url}claim/${claim.id}/summary`
});
console.log('url', `${url}claim/${claim.id}/summary`);
console.log('claim client', claim.client().name);
console.log('claim id', claim.id);
await models.Chat.sendCheckingPresence(ctx, workerId, message);
}
};