mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Merge branch 'master' into suspect-wordlist
This commit is contained in:
+19
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user