Skip to content

Commit

Permalink
Fixed formatting. Closes #2940
Browse files Browse the repository at this point in the history
  • Loading branch information
geekgonecrazy committed Apr 22, 2016
1 parent 4c7619d commit 78480cf
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions packages/rocketchat-lib/server/methods/filterBadWords.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

var Filter = Npm.require('bad-words');
RocketChat.callbacks.add( 'beforeSaveMessage' , function(message){
// console.log(message)
if( RocketChat.settings.get('Message_AllowBadWordsFilter') )
{
var badWordsList = RocketChat.settings.get('Message_BadWordsFilterList');
// console.log(badWordsList)
//Add words to the blacklist
if(!!badWordsList && badWordsList.length)
{
// console.log(badWordsList)
var filter = new Filter({ list: badWordsList.split(',') });
}
else
var filter = new Filter();
message.msg = filter.clean(message.msg);
}
return message;
},1);

RocketChat.callbacks.add('beforeSaveMessage', function(message) {

if (RocketChat.settings.get('Message_AllowBadWordsFilter')) {

var badWordsList = RocketChat.settings.get('Message_BadWordsFilterList');

var options;
// Add words to the blacklist
if (!!badWordsList && badWordsList.length) {
options = {
list: badWordsList.split(',')
};
}

var filter = new Filter(options);

message.msg = filter.clean(message.msg);

return message;
}

}, 1);

0 comments on commit 78480cf

Please sign in to comment.