diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:36:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:44:22 +0200 |
commit | eacb25c4366bcc8fba20f98f93f004fabc6d5578 (patch) | |
tree | d006c6ef3358ec8c3e3deda643dc9b70068f2515 /server/models/account/user.ts | |
parent | a6ce68673ace5b94a81eda3ba198f0a4170eb05e (diff) | |
download | PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.gz PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.zst PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.zip |
Add reason when banning a user
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r-- | server/models/account/user.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index ea6d63312..81b0651fd 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -21,6 +21,7 @@ import { hasUserRight, USER_ROLE_LABELS, UserRight } from '../../../shared' | |||
21 | import { User, UserRole } from '../../../shared/models/users' | 21 | import { User, UserRole } from '../../../shared/models/users' |
22 | import { | 22 | import { |
23 | isUserAutoPlayVideoValid, | 23 | isUserAutoPlayVideoValid, |
24 | isUserBlockedReasonValid, | ||
24 | isUserBlockedValid, | 25 | isUserBlockedValid, |
25 | isUserNSFWPolicyValid, | 26 | isUserNSFWPolicyValid, |
26 | isUserPasswordValid, | 27 | isUserPasswordValid, |
@@ -107,6 +108,12 @@ export class UserModel extends Model<UserModel> { | |||
107 | @Column | 108 | @Column |
108 | blocked: boolean | 109 | blocked: boolean |
109 | 110 | ||
111 | @AllowNull(true) | ||
112 | @Default(null) | ||
113 | @Is('UserBlockedReason', value => throwIfNotValid(value, isUserBlockedReasonValid, 'blocked reason')) | ||
114 | @Column | ||
115 | blockedReason: string | ||
116 | |||
110 | @AllowNull(false) | 117 | @AllowNull(false) |
111 | @Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role')) | 118 | @Is('UserRole', value => throwIfNotValid(value, isUserRoleValid, 'role')) |
112 | @Column | 119 | @Column |
@@ -284,6 +291,8 @@ export class UserModel extends Model<UserModel> { | |||
284 | roleLabel: USER_ROLE_LABELS[ this.role ], | 291 | roleLabel: USER_ROLE_LABELS[ this.role ], |
285 | videoQuota: this.videoQuota, | 292 | videoQuota: this.videoQuota, |
286 | createdAt: this.createdAt, | 293 | createdAt: this.createdAt, |
294 | blocked: this.blocked, | ||
295 | blockedReason: this.blockedReason, | ||
287 | account: this.Account.toFormattedJSON(), | 296 | account: this.Account.toFormattedJSON(), |
288 | videoChannels: [] | 297 | videoChannels: [] |
289 | } | 298 | } |