]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/user.js
Update README features
[github/Chocobozzz/PeerTube.git] / server / models / user.js
index 24e710fa71c6ff1d36dac846dacb83c91ba3d092..e64bab8abc54061778968453e6a7ff0caff71e84 100644 (file)
@@ -39,6 +39,17 @@ module.exports = function (sequelize, DataTypes) {
           isEmail: true
         }
       },
+      displayNSFW: {
+        type: DataTypes.BOOLEAN,
+        allowNull: false,
+        defaultValue: false,
+        validate: {
+          nsfwValid: function (value) {
+            const res = customUsersValidators.isUserDisplayNSFWValid(value)
+            if (res === false) throw new Error('Display NSFW is not valid.')
+          }
+        }
+      },
       role: {
         type: DataTypes.ENUM(values(constants.USER_ROLES)),
         allowNull: false
@@ -101,6 +112,7 @@ function toFormatedJSON () {
     id: this.id,
     username: this.username,
     email: this.email,
+    displayNSFW: this.displayNSFW,
     role: this.role,
     createdAt: this.createdAt
   }