aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-08 17:36:10 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 17:44:22 +0200
commiteacb25c4366bcc8fba20f98f93f004fabc6d5578 (patch)
treed006c6ef3358ec8c3e3deda643dc9b70068f2515 /server/models
parenta6ce68673ace5b94a81eda3ba198f0a4170eb05e (diff)
downloadPeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.gz
PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.zst
PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.zip
Add reason when banning a user
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/user.ts9
-rw-r--r--server/models/video/video-abuse.ts2
2 files changed, 10 insertions, 1 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'
21import { User, UserRole } from '../../../shared/models/users' 21import { User, UserRole } from '../../../shared/models/users'
22import { 22import {
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 }
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index a6319bb79..39f0c2cb2 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -57,7 +57,7 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
57 57
58 @AfterCreate 58 @AfterCreate
59 static sendEmailNotification (instance: VideoAbuseModel) { 59 static sendEmailNotification (instance: VideoAbuseModel) {
60 return Emailer.Instance.addVideoAbuseReport(instance.videoId) 60 return Emailer.Instance.addVideoAbuseReportJob(instance.videoId)
61 } 61 }
62 62
63 static listForApi (start: number, count: number, sort: string) { 63 static listForApi (start: number, count: number, sort: string) {