Merge branch 'master' into suspect-wordlist

This commit is contained in:
Wyatt Johnson
2016-12-15 13:51:16 -07:00
75 changed files with 858 additions and 252 deletions
+19 -3
View File
@@ -1,7 +1,7 @@
const mongoose = require('../mongoose');
const mongoose = require('../services/mongoose');
const Schema = mongoose.Schema;
const _ = require('lodash');
const cache = require('../cache');
const cache = require('../services/cache');
const WordlistSchema = new Schema({
banned: [String],
@@ -46,6 +46,14 @@ const SettingSchema = new Schema({
default: ''
},
wordlist: WordlistSchema,
charCount: {
type: Number,
default: 5000
},
charCountEnable: {
type: Boolean,
default: false
}
}, {
timestamps: {
createdAt: 'created_at',
@@ -83,7 +91,15 @@ SettingSchema.method('merge', function(src) {
*/
SettingSchema.method('filterForUser', function(user = false) {
if (!user || !user.roles.includes('admin')) {
return _.pick(this.toJSON(), ['moderation', 'infoBoxEnable', 'infoBoxContent']);
return _.pick(this.toJSON(), [
'moderation',
'infoBoxEnable',
'infoBoxContent',
'closeTimeout',
'closedMessage',
'charCountEnable',
'charCount'
]);
}
return this.toJSON();