diff options
Diffstat (limited to 'client/src/app')
3 files changed, 29 insertions, 7 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' | |||
5 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 5 | import { RestExtractor, RestPagination, RestService } from '@app/core' |
6 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 6 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
7 | import { CommonVideoParams, Video, VideoService } from '@app/shared/shared-main' | 7 | import { CommonVideoParams, Video, VideoService } from '@app/shared/shared-main' |
8 | import { ResultList, VideoInclude } from '@shared/models' | 8 | import { ResultList, VideoInclude, VideoPrivacy } from '@shared/models' |
9 | import { getAllPrivacies } from '@shared/core-utils' | ||
9 | 10 | ||
10 | @Injectable() | 11 | @Injectable() |
11 | export class VideoAdminService { | 12 | export 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 | } |
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 | } |