Added bannedWordsAllowed attribute to Group attributes (Partial fix for #12405) (#12440)

* Added bannedWordsAllowed attribute to Group attributes

Added an optional Boolean attribute which will determine if banned words are allowed

* Added bannedWordsAllowed attribute to non-settable fields
This commit is contained in:
Scott
2020-08-10 18:38:56 +02:00
committed by GitHub
parent d7ee1ec4f4
commit 5d169d477a
+2 -1
View File
@@ -85,6 +85,7 @@ export const schema = new Schema({
$type: String, enum: ['private', 'public'], default: 'private', required: true,
},
chat: Array, // Used for backward compatibility, but messages aren't stored here
bannedWordsAllowed: { $type: Boolean, required: false },
leaderOnly: { // restrict group actions to leader (members can't do them)
challenges: { $type: Boolean, default: false, required: true },
// invites: {$type: Boolean, default: false, required: true},
@@ -150,7 +151,7 @@ export const schema = new Schema({
});
schema.plugin(baseModel, {
noSet: ['_id', 'balance', 'quest', 'memberCount', 'chat', 'challengeCount', 'tasksOrder', 'purchased', 'managers'],
noSet: ['_id', 'balance', 'quest', 'memberCount', 'chat', 'bannedWordsAllowed', 'challengeCount', 'tasksOrder', 'purchased', 'managers'],
private: ['purchased.plan'],
toJSONTransform (plainObj, originalDoc) {
if (plainObj.purchased) plainObj.purchased.active = originalDoc.hasActiveGroupPlan();