]> 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 35a98dd6b430cc725d4bb64bebd155f2fa522ecc..e64bab8abc54061778968453e6a7ff0caff71e84 100644 (file)
@@ -33,12 +33,23 @@ module.exports = function (sequelize, DataTypes) {
         }
       },
       email: {
-        type: DataTypes.STRING,
+        type: DataTypes.STRING(400),
         allowNull: false,
         validate: {
           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
   }