aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-03 21:24:36 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-03 21:24:36 +0200
commit1d49e1e27d63db1dfc9a7fd28c9902f488831a89 (patch)
treece3353ad691876c55ce8fcfdd70bfa2b9112b39a /server/models
parent31b59b477459d4f26ed8ef089a0e5553fb6a332b (diff)
downloadPeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.tar.gz
PeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.tar.zst
PeerTube-1d49e1e27d63db1dfc9a7fd28c9902f488831a89.zip
Server: Add NSFW in user profile
Diffstat (limited to 'server/models')
-rw-r--r--server/models/user.js12
1 files changed, 12 insertions, 0 deletions
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) {
39 isEmail: true 39 isEmail: true
40 } 40 }
41 }, 41 },
42 displayNSFW: {
43 type: DataTypes.BOOLEAN,
44 allowNull: false,
45 defaultValue: false,
46 validate: {
47 nsfwValid: function (value) {
48 const res = customUsersValidators.isUserDisplayNSFWValid(value)
49 if (res === false) throw new Error('Display NSFW is not valid.')
50 }
51 }
52 },
42 role: { 53 role: {
43 type: DataTypes.ENUM(values(constants.USER_ROLES)), 54 type: DataTypes.ENUM(values(constants.USER_ROLES)),
44 allowNull: false 55 allowNull: false
@@ -101,6 +112,7 @@ function toFormatedJSON () {
101 id: this.id, 112 id: this.id,
102 username: this.username, 113 username: this.username,
103 email: this.email, 114 email: this.email,
115 displayNSFW: this.displayNSFW,
104 role: this.role, 116 role: this.role,
105 createdAt: this.createdAt 117 createdAt: this.createdAt
106 } 118 }