aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-12 14:19:56 +0100
committerChocobozzz <me@florianbigard.com>2021-11-12 14:23:22 +0100
commit527a52ac4295a072927ff46761766a8b181a7603 (patch)
tree632f66b1691d8d72f04630671af8bdf1655d6b00 /client/src/app/+admin
parent8f2608e9a9d54c87ace636f99cdb9d2a7730990f (diff)
downloadPeerTube-527a52ac4295a072927ff46761766a8b181a7603.tar.gz
PeerTube-527a52ac4295a072927ff46761766a8b181a7603.tar.zst
PeerTube-527a52ac4295a072927ff46761766a8b181a7603.zip
Add ability to filter out public videos from admin
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/overview/videos/video-admin.service.ts24
1 files changed, 20 insertions, 4 deletions
diff --git a/client/src/app/+admin/overview/videos/video-admin.service.ts b/client/src/app/+admin/overview/videos/video-admin.service.ts
index f80de7acd..6a0e8dade 100644
--- a/client/src/app/+admin/overview/videos/video-admin.service.ts
+++ b/client/src/app/+admin/overview/videos/video-admin.service.ts
@@ -5,7 +5,8 @@ import { Injectable } from '@angular/core'
5import { RestExtractor, RestPagination, RestService } from '@app/core' 5import { RestExtractor, RestPagination, RestService } from '@app/core'
6import { AdvancedInputFilter } from '@app/shared/shared-forms' 6import { AdvancedInputFilter } from '@app/shared/shared-forms'
7import { CommonVideoParams, Video, VideoService } from '@app/shared/shared-main' 7import { CommonVideoParams, Video, VideoService } from '@app/shared/shared-main'
8import { ResultList, VideoInclude } from '@shared/models' 8import { ResultList, VideoInclude, VideoPrivacy } from '@shared/models'
9import { getAllPrivacies } from '@shared/core-utils'
9 10
10@Injectable() 11@Injectable()
11export class VideoAdminService { 12export class VideoAdminService {
@@ -96,6 +97,10 @@ export class VideoAdminService {
96 { 97 {
97 value: 'excludeMuted', 98 value: 'excludeMuted',
98 label: $localize`Exclude muted accounts` 99 label: $localize`Exclude muted accounts`
100 },
101 {
102 value: 'excludePublic',
103 label: $localize`Exclude public videos`
99 } 104 }
100 ] 105 ]
101 } 106 }
@@ -105,11 +110,12 @@ export class VideoAdminService {
105 private buildAdminParamsFromSearch (search: string, params: HttpParams) { 110 private buildAdminParamsFromSearch (search: string, params: HttpParams) {
106 let include = VideoInclude.BLACKLISTED | 111 let include = VideoInclude.BLACKLISTED |
107 VideoInclude.BLOCKED_OWNER | 112 VideoInclude.BLOCKED_OWNER |
108 VideoInclude.HIDDEN_PRIVACY |
109 VideoInclude.NOT_PUBLISHED_STATE | 113 VideoInclude.NOT_PUBLISHED_STATE |
110 VideoInclude.FILES 114 VideoInclude.FILES
111 115
112 if (!search) return this.restService.addObjectParams(params, { include }) 116 let privacyOneOf = getAllPrivacies()
117
118 if (!search) return this.restService.addObjectParams(params, { include, privacyOneOf })
113 119
114 const filters = this.restService.parseQueryStringFilter(search, { 120 const filters = this.restService.parseQueryStringFilter(search, {
115 isLocal: { 121 isLocal: {
@@ -131,6 +137,10 @@ export class VideoAdminService {
131 excludeMuted: { 137 excludeMuted: {
132 prefix: 'excludeMuted', 138 prefix: 'excludeMuted',
133 handler: () => true 139 handler: () => true
140 },
141 excludePublic: {
142 prefix: 'excludePublic',
143 handler: () => true
134 } 144 }
135 }) 145 })
136 146
@@ -140,6 +150,12 @@ export class VideoAdminService {
140 filters.excludeMuted = undefined 150 filters.excludeMuted = undefined
141 } 151 }
142 152
143 return this.restService.addObjectParams(params, { ...filters, include }) 153 if (filters.excludePublic) {
154 privacyOneOf = [ VideoPrivacy.PRIVATE, VideoPrivacy.UNLISTED, VideoPrivacy.INTERNAL ]
155
156 filters.excludePublic = undefined
157 }
158
159 return this.restService.addObjectParams(params, { ...filters, include, privacyOneOf })
144 } 160 }
145} 161}