X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Fmodels%2Fuser.js;h=e64bab8abc54061778968453e6a7ff0caff71e84;hb=00871a261787ae1ed8446861ba2bd5eea9faca6d;hp=24e710fa71c6ff1d36dac846dacb83c91ba3d092;hpb=5804c0db337ecf492fc61b98a3de7b730a0d8ce3;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/user.js b/server/models/user.js index 24e710fa7..e64bab8ab 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -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 }