mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Merge pull request #418 from zoff-music/feature/disable-chat
Fallback for channels without togglechat settings
This commit is contained in:
@@ -90,7 +90,7 @@ function chat(msg, guid, offline, socket) {
|
|||||||
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
||||||
}
|
}
|
||||||
db.collection(coll + "_settings").find(function(err, conf){
|
db.collection(coll + "_settings").find(function(err, conf){
|
||||||
if(conf.length > 0 && !conf[0].toggleChat) {
|
if(conf.length > 0 && (conf[0].hasOwnProperty("toggleChat") && !conf[0].toggleChat)) {
|
||||||
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
||||||
return;
|
return;
|
||||||
} else if(conf.length > 0 && (conf[0].userpass == undefined || conf[0].userpass == "" || (msg.hasOwnProperty('pass') && conf[0].userpass == msg.pass))) {
|
} else if(conf.length > 0 && (conf[0].userpass == undefined || conf[0].userpass == "" || (msg.hasOwnProperty('pass') && conf[0].userpass == msg.pass))) {
|
||||||
@@ -233,7 +233,7 @@ function checkIfChatEnabled(channel, socket, callback) {
|
|||||||
if(channel == "" || channel == undefined) callback();
|
if(channel == "" || channel == undefined) callback();
|
||||||
else {
|
else {
|
||||||
db.collection(channel + "_settings").find(function(err, docs){
|
db.collection(channel + "_settings").find(function(err, docs){
|
||||||
if(docs.length > 0 && !docs[0].toggleChat) {
|
if(docs.length > 0 && (docs[0].hasOwnProperty("toggleChat") && !docs[0].toggleChat)) {
|
||||||
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
|
|||||||
Reference in New Issue
Block a user