@@ -24,7 +24,7 @@ var Beep = {
2424
2525 parseContent : function ( content ) {
2626 var nil = '^(?!x)x' ;
27- return parseContent ( content , Beep . banned_words || nil , Beep . banned_urls || nil , Beep . censorWholeWord || nil ) ;
27+ return parseContent ( content , Beep . banned_words || nil , Beep . banned_urls || nil , Beep . censorWholeWord ) ;
2828 } ,
2929 toRegExp : toRegExp ,
3030 loadList : function ( callback ) {
@@ -34,21 +34,27 @@ var Beep = {
3434 return callback ( err ) ;
3535 }
3636
37- Beep . illegal_words = new RegExp ( '\\b(?:' + Beep . toRegExp ( hash . illegal ) + ')\\b' , 'ig' ) ;
37+ Beep . illegal_words = Beep . toRegExp ( hash . illegal , true ) ;
3838
3939 if ( hash . id && hash . id . length ) {
4040 var words = hash . id . split ( ',' ) . filter ( function ( word ) {
4141 return ! Beep . illegal_words . test ( word ) ;
4242 } ) ;
43- Beep . banned_words = new RegExp ( '\\b(?:' + Beep . toRegExp ( words ) + ')\\b' , 'ig' ) ;
43+ Beep . banned_words = Beep . toRegExp ( words , true ) ;
4444 Beep . banned_words_raw = hash . id ;
4545 } else {
46- Beep . banned_words = new RegExp ( '\\b(?:' + Beep . toRegExp ( defaultBanList ) + ')\\b' , 'ig' ) ;
46+ Beep . banned_words = Beep . toRegExp ( defaultBanList , true ) ;
4747 Beep . banned_words_raw = defaultBanList . join ( ',' ) ;
4848 winston . info ( 'Default list of Banned Words is enabled. Please go to administration panel to change the list.' ) ;
4949 }
50- Beep . banned_urls = new RegExp ( Beep . toRegExp ( hash . urls ) , 'ig' ) ;
50+
51+ Beep . banned_urls = Beep . toRegExp ( hash . urls ) ;
52+
5153 Beep . censorWholeWord = hash . censorWholeWord === 'on' ;
54+ if ( meta . config ) {
55+ meta . config . beep = meta . config . beep || { } ;
56+ meta . config . beep . censorWholeWord = Beep . censorWholeWord ;
57+ }
5258
5359 callback ( ) ;
5460 } ) ;
@@ -79,7 +85,7 @@ var Beep = {
7985 }
8086 config . beep = {
8187 censorWholeWord : censorWholeWord === 'on'
82- }
88+ } ;
8389 callback ( err , config ) ;
8490 } ) ;
8591 } ,
@@ -141,26 +147,6 @@ var Beep = {
141147 callback ( null , custom_header ) ;
142148 }
143149 } ,
144- category : {
145- get : function ( data , callback ) {
146- var topics = data . category . topics ;
147- topics . forEach ( function ( topic ) {
148- topic . title = Beep . parseContent ( topic . title ) ;
149- topic . slug = Beep . parseContent ( topic . slug ) ;
150- } ) ;
151- callback ( null , data ) ;
152- } ,
153- topics : {
154- get : function ( data , callback ) {
155- data . topics . forEach ( function ( topic ) {
156- topic . title = Beep . parseContent ( topic . title ) ;
157- topic . slug = Beep . parseContent ( topic . slug ) ;
158- topic . titleRaw = Beep . parseContent ( topic . titleRaw ) ;
159- } ) ;
160- callback ( null , data ) ;
161- }
162- }
163- } ,
164150 post : {
165151 getFields : function ( data , callback ) {
166152 if ( data . fields . indexOf ( 'content' ) !== - 1 ) {
0 commit comments