diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-12 14:19:56 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-12 14:23:22 +0100 |
commit | 527a52ac4295a072927ff46761766a8b181a7603 (patch) | |
tree | 632f66b1691d8d72f04630671af8bdf1655d6b00 /client/src/app/shared | |
parent | 8f2608e9a9d54c87ace636f99cdb9d2a7730990f (diff) | |
download | PeerTube-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/shared')
-rw-r--r-- | client/src/app/shared/shared-main/video/video.service.ts | 3 | ||||
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-filters.model.ts | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 6edcc3fe0..570e8e3be 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts | |||
@@ -38,6 +38,7 @@ export type CommonVideoParams = { | |||
38 | isLocal?: boolean | 38 | isLocal?: boolean |
39 | categoryOneOf?: number[] | 39 | categoryOneOf?: number[] |
40 | languageOneOf?: string[] | 40 | languageOneOf?: string[] |
41 | privacyOneOf?: VideoPrivacy[] | ||
41 | isLive?: boolean | 42 | isLive?: boolean |
42 | skipCount?: boolean | 43 | skipCount?: boolean |
43 | 44 | ||
@@ -392,6 +393,7 @@ export class VideoService { | |||
392 | include, | 393 | include, |
393 | categoryOneOf, | 394 | categoryOneOf, |
394 | languageOneOf, | 395 | languageOneOf, |
396 | privacyOneOf, | ||
395 | skipCount, | 397 | skipCount, |
396 | nsfwPolicy, | 398 | nsfwPolicy, |
397 | isLive, | 399 | isLive, |
@@ -413,6 +415,7 @@ export class VideoService { | |||
413 | if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) | 415 | if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) |
414 | if (languageOneOf) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf) | 416 | if (languageOneOf) newParams = this.restService.addArrayParams(newParams, 'languageOneOf', languageOneOf) |
415 | if (categoryOneOf) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf) | 417 | if (categoryOneOf) newParams = this.restService.addArrayParams(newParams, 'categoryOneOf', categoryOneOf) |
418 | if (privacyOneOf) newParams = this.restService.addArrayParams(newParams, 'privacyOneOf', privacyOneOf) | ||
416 | 419 | ||
417 | return newParams | 420 | return newParams |
418 | } | 421 | } |
diff --git a/client/src/app/shared/shared-video-miniature/video-filters.model.ts b/client/src/app/shared/shared-video-miniature/video-filters.model.ts index 5ad7cf3f7..982880b0e 100644 --- a/client/src/app/shared/shared-video-miniature/video-filters.model.ts +++ b/client/src/app/shared/shared-video-miniature/video-filters.model.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { intoArray, toBoolean } from '@app/helpers' | 1 | import { intoArray, toBoolean } from '@app/helpers' |
2 | import { AttributesOnly } from '@shared/core-utils' | 2 | import { AttributesOnly, getAllPrivacies } from '@shared/core-utils' |
3 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoSortField } from '@shared/models' | 3 | import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoPrivacy, VideoSortField } from '@shared/models' |
4 | 4 | ||
5 | type VideoFiltersKeys = { | 5 | type VideoFiltersKeys = { |
6 | [ id in keyof AttributesOnly<VideoFilters> ]: any | 6 | [ id in keyof AttributesOnly<VideoFilters> ]: any |
@@ -198,13 +198,15 @@ export class VideoFilters { | |||
198 | toVideosAPIObject () { | 198 | toVideosAPIObject () { |
199 | let isLocal: boolean | 199 | let isLocal: boolean |
200 | let include: VideoInclude | 200 | let include: VideoInclude |
201 | let privacyOneOf: VideoPrivacy[] | ||
201 | 202 | ||
202 | if (this.scope === 'local') { | 203 | if (this.scope === 'local') { |
203 | isLocal = true | 204 | isLocal = true |
204 | } | 205 | } |
205 | 206 | ||
206 | if (this.allVideos) { | 207 | if (this.allVideos) { |
207 | include = VideoInclude.NOT_PUBLISHED_STATE | VideoInclude.HIDDEN_PRIVACY | 208 | include = VideoInclude.NOT_PUBLISHED_STATE |
209 | privacyOneOf = getAllPrivacies() | ||
208 | } | 210 | } |
209 | 211 | ||
210 | let isLive: boolean | 212 | let isLive: boolean |
@@ -219,6 +221,7 @@ export class VideoFilters { | |||
219 | search: this.search, | 221 | search: this.search, |
220 | isLocal, | 222 | isLocal, |
221 | include, | 223 | include, |
224 | privacyOneOf, | ||
222 | isLive | 225 | isLive |
223 | } | 226 | } |
224 | } | 227 | } |