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