Changes
gitea/salix/master This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-02-11 09:14:40 +01:00
parent d481b0c71f
commit df21309e0a
1 changed files with 4 additions and 9 deletions

View File

@ -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'
@ -42,12 +39,10 @@ module.exports = Self => {
const department = workerDepartment.department();
const channelName = department.chatName;
if (channelName) {
message = `@${account.name} => ${message}`;
room = `#${channelName}`;
} else room = `@${account.name}`;
if (channelName)
return Self.send(ctx, `#${channelName}`, `@${account.name} => ${message}`);
}
return Self.send(ctx, room, message);
return Self.send(ctx, `@${account.name}`, message);
};
};