mirror of
https://github.com/thelounge/thelounge
synced 2024-11-11 07:04:18 +00:00
Log notices as correct sender when it will be shown in active window
This commit is contained in:
parent
a267add7a4
commit
5dced897d8
1 changed files with 13 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
const _ = require("lodash");
|
||||
const Helper = require("../helper");
|
||||
const User = require("./user");
|
||||
const Msg = require("./msg");
|
||||
const storage = require("../plugins/storage");
|
||||
|
||||
module.exports = Chan;
|
||||
|
@ -185,9 +186,19 @@ Chan.prototype.writeUserLog = function(client, msg) {
|
|||
return;
|
||||
}
|
||||
|
||||
let targetChannel = this;
|
||||
|
||||
// Is this particular message or channel loggable
|
||||
if (!msg.isLoggable() || !this.isLoggable()) {
|
||||
return;
|
||||
// Because notices are nasty and can be shown in active channel on the client
|
||||
// if there is no open query, we want to always log notices in the sender's name
|
||||
if (msg.type === Msg.Type.NOTICE && msg.showInActive) {
|
||||
targetChannel = {
|
||||
name: msg.from.nick,
|
||||
};
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the parent network where this channel is in
|
||||
|
@ -198,7 +209,7 @@ Chan.prototype.writeUserLog = function(client, msg) {
|
|||
}
|
||||
|
||||
for (const messageStorage of client.messageStorage) {
|
||||
messageStorage.index(target.network, this, msg);
|
||||
messageStorage.index(target.network, targetChannel, msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue