aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-07-02 22:49:51 +0200
committerRigel Kent <sendmemail@rigelk.eu>2020-07-02 22:50:33 +0200
commit8491293b02ed2ec53eb0fa128161ea0b08d3def9 (patch)
treeb3d8dd2732f5876e39c73b7d917a7ad02f4e021a /server/models/account/user.ts
parent2b587cad93381a1901df3c993bf1db90bbb0891f (diff)
downloadPeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.tar.gz
PeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.tar.zst
PeerTube-8491293b02ed2ec53eb0fa128161ea0b08d3def9.zip
add blocked filter in users list to filter banned users
fixes #2914
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r--server/models/account/user.ts21
1 files changed, 17 insertions, 4 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 3bde1e744..de193131a 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -412,11 +412,18 @@ export class UserModel extends Model<UserModel> {
412 return this.count() 412 return this.count()
413 } 413 }
414 414
415 static listForApi (start: number, count: number, sort: string, search?: string) { 415 static listForApi (parameters: {
416 let where: WhereOptions 416 start: number
417 count: number
418 sort: string
419 search?: string
420 blocked?: boolean
421 }) {
422 const { start, count, sort, search, blocked } = parameters
423 const where: WhereOptions = {}
417 424
418 if (search) { 425 if (search) {
419 where = { 426 Object.assign(where, {
420 [Op.or]: [ 427 [Op.or]: [
421 { 428 {
422 email: { 429 email: {
@@ -429,7 +436,13 @@ export class UserModel extends Model<UserModel> {
429 } 436 }
430 } 437 }
431 ] 438 ]
432 } 439 })
440 }
441
442 if (blocked !== undefined) {
443 Object.assign(where, {
444 blocked: blocked
445 })
433 } 446 }
434 447
435 const query: FindOptions = { 448 const query: FindOptions = {