Merge branch '2093-chat_mention_destinatary' of verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
5313ffff2e
|
@ -30,10 +30,7 @@ module.exports = Self => {
|
|||
const query = `SELECT worker_isWorking(?) isWorking`;
|
||||
const [result] = await Self.rawSql(query, [workerId]);
|
||||
|
||||
let room;
|
||||
if (result.isWorking)
|
||||
room = `@${account.name}`;
|
||||
else {
|
||||
if (!result.isWorking) {
|
||||
const workerDepartment = await models.WorkerDepartment.findById(workerId, {
|
||||
include: {
|
||||
relation: 'department'
|
||||
|
@ -41,13 +38,11 @@ module.exports = Self => {
|
|||
});
|
||||
const department = workerDepartment.department();
|
||||
const channelName = department.chatName;
|
||||
room = `#${channelName}`;
|
||||
|
||||
if (channelName)
|
||||
room = `#${channelName}`;
|
||||
else room = `@${account.name}`;
|
||||
return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`);
|
||||
}
|
||||
|
||||
return Self.send(ctx, room, message);
|
||||
return Self.send(ctx, `@${account.name}`, message);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('chat sendCheckingPresence()', () => {
|
|||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
expect(response.message).toEqual('Fake notification sent');
|
||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', 'I changed something');
|
||||
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym => I changed something');
|
||||
});
|
||||
|
||||
it(`should call to send() method with the worker username when the worker is working`, async() => {
|
||||
|
|
Loading…
Reference in New Issue