Merge pull request #1693 from thelounge/xpaw/fix-1692

Fix #1692 when kicker is server
This commit is contained in:
Pavel Djundik 2017-11-10 17:09:34 +02:00 committed by GitHub
commit 48b6a136d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@
var _ = require("lodash"); var _ = require("lodash");
var Helper = require("../helper"); var Helper = require("../helper");
const User = require("./user");
const userLog = require("../userLog"); const userLog = require("../userLog");
const storage = require("../plugins/storage"); const storage = require("../plugins/storage");
@ -121,6 +122,10 @@ Chan.prototype.findUser = function(nick) {
return _.find(this.users, {nick: nick}); return _.find(this.users, {nick: nick});
}; };
Chan.prototype.getUser = function(nick) {
return this.findUser(nick) || new User({nick: nick});
};
Chan.prototype.getMode = function(name) { Chan.prototype.getMode = function(name) {
var user = this.findUser(name); var user = this.findUser(name);
if (user) { if (user) {

View File

@ -11,8 +11,8 @@ module.exports = function(irc, network) {
return; return;
} }
const kicker = chan.findUser(data.nick); const kicker = chan.getUser(data.nick);
const target = chan.findUser(data.kicked); const target = chan.getUser(data.kicked);
if (data.kicked === irc.user.nick) { if (data.kicked === irc.user.nick) {
chan.users = []; chan.users = [];