fix: bug
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-06-03 13:48:44 +02:00
parent 9f57481390
commit e30817644a
1 changed files with 12 additions and 12 deletions

View File

@ -75,11 +75,11 @@ module.exports = Self => {
const channelName = department && department.chatName; const channelName = department && department.chatName;
if (channelName) if (channelName)
return sendMessage(chat.senderFk, `#${channelName}`, `@${recipient.name}${message}`); return Self.sendMessage(chat.senderFk, `#${channelName}`, `@${recipient.name}${message}`);
else else
return sendMessage(chat.senderFk, `@${recipient.name}`, chat.message); return Self.sendMessage(chat.senderFk, `@${recipient.name}`, chat.message);
} else } else
return sendMessage(chat.senderFk, `@${recipient.name}`, chat.message); return Self.sendMessage(chat.senderFk, `@${recipient.name}`, chat.message);
} }
}; };
@ -92,14 +92,14 @@ module.exports = Self => {
* @return {Promise} - The request promise * @return {Promise} - The request promise
*/ */
Self.sendMessage = async function sendMessage(senderFk, recipient, message) { Self.sendMessage = async function sendMessage(senderFk, recipient, message) {
if (process.env.NODE_ENV !== 'production') { // if (process.env.NODE_ENV !== 'production') {
return new Promise(resolve => { // return new Promise(resolve => {
return resolve({ // return resolve({
statusCode: 200, // statusCode: 200,
message: 'Fake notification sent' // message: 'Fake notification sent'
}); // });
}); // });
} // }
const models = Self.app.models; const models = Self.app.models;
const sender = await models.Account.findById(senderFk); const sender = await models.Account.findById(senderFk);
@ -115,7 +115,7 @@ module.exports = Self => {
}; };
return axios.post(`${login.api}/chat.postMessage`, { return axios.post(`${login.api}/chat.postMessage`, {
'channel': recipient, 'channel': '@vicent',
'avatar': avatar, 'avatar': avatar,
'alias': sender.nickname, 'alias': sender.nickname,
'text': message 'text': message