aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html13
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.scss2
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts32
-rw-r--r--client/src/app/+videos/+video-watch/shared/information/video-alert.component.html2
-rw-r--r--client/src/app/+videos/video-list/videos-list-common-page.component.ts2
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts3
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts6
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts11
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts34
-rw-r--r--client/src/app/shared/shared-moderation/video-block.component.ts2
-rw-r--r--client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts2
-rw-r--r--client/src/app/shared/shared-video-miniature/video-filters.model.ts22
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.html2
13 files changed, 88 insertions, 45 deletions
diff --git a/client/src/app/+admin/overview/videos/video-list.component.html b/client/src/app/+admin/overview/videos/video-list.component.html
index 1f1e9cc6e..6250c00fb 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -63,10 +63,17 @@
63 <my-video-cell [video]="video"></my-video-cell> 63 <my-video-cell [video]="video"></my-video-cell>
64 </td> 64 </td>
65 65
66 <td> 66 <td class="badges">
67 <span class="badge badge-blue" i18n>{{ video.privacy.label }}</span> 67 <span [ngClass]="getPrivacyBadgeClass(video.privacy.id)" class="badge" i18n>{{ video.privacy.label }}</span>
68
68 <span *ngIf="video.nsfw" class="badge badge-red" i18n>NSFW</span> 69 <span *ngIf="video.nsfw" class="badge badge-red" i18n>NSFW</span>
69 <span *ngIf="video.blocked" class="badge badge-red" i18n>NSFW</span> 70
71 <span *ngIf="isUnpublished(video.state.id)" class="badge badge-yellow" i18n>Not published yet</span>
72
73 <span *ngIf="isAccountBlocked(video)" class="badge badge-red" i18n>Account muted</span>
74 <span *ngIf="isServerBlocked(video)" class="badge badge-red" i18n>Server muted</span>
75
76 <span *ngIf="isVideoBlocked(video)" class="badge badge-red" i18n>Blocked</span>
70 </td> 77 </td>
71 78
72 <td> 79 <td>
diff --git a/client/src/app/+admin/overview/videos/video-list.component.scss b/client/src/app/+admin/overview/videos/video-list.component.scss
index fcdb457f2..250a917e4 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.scss
+++ b/client/src/app/+admin/overview/videos/video-list.component.scss
@@ -7,4 +7,6 @@ my-embed {
7 7
8.badge { 8.badge {
9 @include table-badge; 9 @include table-badge;
10
11 margin-right: 5px;
10} 12}
diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts
index a445bc209..dd9225e6a 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
5import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' 5import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
6import { UserRight } from '@shared/models' 6import { UserRight, VideoPrivacy, VideoState } from '@shared/models'
7import { AdvancedInputFilter } from '@app/shared/shared-forms' 7import { AdvancedInputFilter } from '@app/shared/shared-forms'
8import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' 8import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
9 9
@@ -28,8 +28,12 @@ export class VideoListComponent extends RestTable implements OnInit {
28 title: $localize`Advanced filters`, 28 title: $localize`Advanced filters`,
29 children: [ 29 children: [
30 { 30 {
31 queryParams: { search: 'local:true' }, 31 queryParams: { search: 'isLocal:false' },
32 label: $localize`Only local videos` 32 label: $localize`Remote videos`
33 },
34 {
35 queryParams: { search: 'isLocal:true' },
36 label: $localize`Local videos`
33 } 37 }
34 ] 38 ]
35 } 39 }
@@ -88,6 +92,28 @@ export class VideoListComponent extends RestTable implements OnInit {
88 this.reloadData() 92 this.reloadData()
89 } 93 }
90 94
95 getPrivacyBadgeClass (privacy: VideoPrivacy) {
96 if (privacy === VideoPrivacy.PUBLIC) return 'badge-blue'
97
98 return 'badge-yellow'
99 }
100
101 isUnpublished (state: VideoState) {
102 return state !== VideoState.PUBLISHED
103 }
104
105 isAccountBlocked (video: Video) {
106 return video.blockedOwner
107 }
108
109 isServerBlocked (video: Video) {
110 return video.blockedServer
111 }
112
113 isVideoBlocked (video: Video) {
114 return video.blacklisted
115 }
116
91 protected reloadData () { 117 protected reloadData () {
92 this.selectedVideos = [] 118 this.selectedVideos = []
93 119
diff --git a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html
index e2dd44bf7..33b5a47a0 100644
--- a/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html
+++ b/client/src/app/+videos/+video-watch/shared/information/video-alert.component.html
@@ -24,5 +24,5 @@
24 24
25<div class="alert alert-danger" *ngIf="video?.blacklisted"> 25<div class="alert alert-danger" *ngIf="video?.blacklisted">
26 <div class="blocked-label" i18n>This video is blocked.</div> 26 <div class="blocked-label" i18n>This video is blocked.</div>
27 {{ video.blockedReason }} 27 {{ video.blacklistedReason }}
28</div> 28</div>
diff --git a/client/src/app/+videos/video-list/videos-list-common-page.component.ts b/client/src/app/+videos/video-list/videos-list-common-page.component.ts
index ba64d4fec..d03b09610 100644
--- a/client/src/app/+videos/video-list/videos-list-common-page.component.ts
+++ b/client/src/app/+videos/video-list/videos-list-common-page.component.ts
@@ -85,7 +85,7 @@ export class VideosListCommonPageComponent implements OnInit, OnDestroy, Disable
85 getSyndicationItems (filters: VideoFilters) { 85 getSyndicationItems (filters: VideoFilters) {
86 const result = filters.toVideosAPIObject() 86 const result = filters.toVideosAPIObject()
87 87
88 return this.videoService.getVideoFeedUrls(result.sort, result.filter) 88 return this.videoService.getVideoFeedUrls(result.sort, result.isLocal)
89 } 89 }
90 90
91 onFiltersChanged (filters: VideoFilters) { 91 onFiltersChanged (filters: VideoFilters) {
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index ab640d348..a959b336d 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -7,7 +7,6 @@ import {
7 ContainerMarkupData, 7 ContainerMarkupData,
8 EmbedMarkupData, 8 EmbedMarkupData,
9 PlaylistMiniatureMarkupData, 9 PlaylistMiniatureMarkupData,
10 VideoFilter,
11 VideoMiniatureMarkupData, 10 VideoMiniatureMarkupData,
12 VideosListMarkupData 11 VideosListMarkupData
13} from '@shared/models' 12} from '@shared/models'
@@ -193,7 +192,7 @@ export class CustomMarkupService {
193 192
194 isLive: this.buildBoolean(data.isLive), 193 isLive: this.buildBoolean(data.isLive),
195 194
196 filter: this.buildBoolean(data.onlyLocal) ? 'local' as VideoFilter : undefined 195 isLocal: this.buildBoolean(data.onlyLocal) ? true : undefined
197 } 196 }
198 197
199 this.dynamicElementService.setModel(component, model) 198 this.dynamicElementService.setModel(component, model)
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
index 856e43681..0e4d5fb12 100644
--- a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
@@ -1,7 +1,7 @@
1import { finalize } from 'rxjs/operators' 1import { finalize } from 'rxjs/operators'
2import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' 2import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
3import { AuthService, Notifier } from '@app/core' 3import { AuthService, Notifier } from '@app/core'
4import { VideoFilter, VideoSortField } from '@shared/models' 4import { VideoSortField } from '@shared/models'
5import { Video, VideoService } from '../../shared-main' 5import { Video, VideoService } from '../../shared-main'
6import { MiniatureDisplayOptions } from '../../shared-video-miniature' 6import { MiniatureDisplayOptions } from '../../shared-video-miniature'
7import { CustomMarkupComponent } from './shared' 7import { CustomMarkupComponent } from './shared'
@@ -21,7 +21,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
21 @Input() languageOneOf: string[] 21 @Input() languageOneOf: string[]
22 @Input() count: number 22 @Input() count: number
23 @Input() onlyDisplayTitle: boolean 23 @Input() onlyDisplayTitle: boolean
24 @Input() filter: VideoFilter 24 @Input() isLocal: boolean
25 @Input() isLive: boolean 25 @Input() isLive: boolean
26 @Input() maxRows: number 26 @Input() maxRows: number
27 @Input() channelHandle: string 27 @Input() channelHandle: string
@@ -86,7 +86,7 @@ export class VideosListMarkupComponent implements CustomMarkupComponent, OnInit
86 }, 86 },
87 categoryOneOf: this.categoryOneOf, 87 categoryOneOf: this.categoryOneOf,
88 languageOneOf: this.languageOneOf, 88 languageOneOf: this.languageOneOf,
89 filter: this.filter, 89 isLocal: this.isLocal,
90 isLive: this.isLive, 90 isLive: this.isLive,
91 sort: this.sort as VideoSortField, 91 sort: this.sort as VideoSortField,
92 account: { nameWithHost: this.accountHandle }, 92 account: { nameWithHost: this.accountHandle },
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index 10caec014..699eac7f1 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -65,8 +65,12 @@ export class Video implements VideoServerModel {
65 waitTranscoding?: boolean 65 waitTranscoding?: boolean
66 state?: VideoConstant<VideoState> 66 state?: VideoConstant<VideoState>
67 scheduledUpdate?: VideoScheduleUpdate 67 scheduledUpdate?: VideoScheduleUpdate
68
68 blacklisted?: boolean 69 blacklisted?: boolean
69 blockedReason?: string 70 blacklistedReason?: string
71
72 blockedOwner?: boolean
73 blockedServer?: boolean
70 74
71 account: { 75 account: {
72 id: number 76 id: number
@@ -163,7 +167,10 @@ export class Video implements VideoServerModel {
163 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations) 167 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
164 168
165 this.blacklisted = hash.blacklisted 169 this.blacklisted = hash.blacklisted
166 this.blockedReason = hash.blacklistedReason 170 this.blacklistedReason = hash.blacklistedReason
171
172 this.blockedOwner = hash.blockedOwner
173 this.blockedServer = hash.blockedServer
167 174
168 this.userHistory = hash.userHistory 175 this.userHistory = hash.userHistory
169 176
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 9e3aa1e6a..0a3a51b0c 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -18,7 +18,7 @@ import {
18 VideoConstant, 18 VideoConstant,
19 VideoDetails as VideoDetailsServerModel, 19 VideoDetails as VideoDetailsServerModel,
20 VideoFileMetadata, 20 VideoFileMetadata,
21 VideoFilter, 21 VideoInclude,
22 VideoPrivacy, 22 VideoPrivacy,
23 VideoSortField, 23 VideoSortField,
24 VideoUpdate 24 VideoUpdate
@@ -34,11 +34,13 @@ import { Video } from './video.model'
34export type CommonVideoParams = { 34export type CommonVideoParams = {
35 videoPagination?: ComponentPaginationLight 35 videoPagination?: ComponentPaginationLight
36 sort: VideoSortField | SortMeta 36 sort: VideoSortField | SortMeta
37 filter?: VideoFilter 37 include?: VideoInclude
38 isLocal?: boolean
38 categoryOneOf?: number[] 39 categoryOneOf?: number[]
39 languageOneOf?: string[] 40 languageOneOf?: string[]
40 isLive?: boolean 41 isLive?: boolean
41 skipCount?: boolean 42 skipCount?: boolean
43
42 // FIXME: remove? 44 // FIXME: remove?
43 nsfwPolicy?: NSFWPolicyType 45 nsfwPolicy?: NSFWPolicyType
44 nsfw?: BooleanBothQuery 46 nsfw?: BooleanBothQuery
@@ -202,12 +204,14 @@ export class VideoService {
202 } 204 }
203 205
204 getAdminVideos ( 206 getAdminVideos (
205 parameters: Omit<CommonVideoParams, 'filter'> & { pagination: RestPagination, search?: string } 207 parameters: CommonVideoParams & { pagination: RestPagination, search?: string }
206 ): Observable<ResultList<Video>> { 208 ): Observable<ResultList<Video>> {
207 const { pagination, search } = parameters 209 const { pagination, search } = parameters
208 210
211 const include = VideoInclude.BLACKLISTED | VideoInclude.BLOCKED_OWNER | VideoInclude.HIDDEN_PRIVACY | VideoInclude.NOT_PUBLISHED_STATE
212
209 let params = new HttpParams() 213 let params = new HttpParams()
210 params = this.buildCommonVideosParams({ params, ...parameters }) 214 params = this.buildCommonVideosParams({ params, include, ...parameters })
211 215
212 params = params.set('start', pagination.start.toString()) 216 params = params.set('start', pagination.start.toString())
213 .set('count', pagination.count.toString()) 217 .set('count', pagination.count.toString())
@@ -216,8 +220,6 @@ export class VideoService {
216 params = this.buildAdminParamsFromSearch(search, params) 220 params = this.buildAdminParamsFromSearch(search, params)
217 } 221 }
218 222
219 if (!params.has('filter')) params = params.set('filter', 'all')
220
221 return this.authHttp 223 return this.authHttp
222 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params }) 224 .get<ResultList<Video>>(VideoService.BASE_VIDEO_URL, { params })
223 .pipe( 225 .pipe(
@@ -266,10 +268,10 @@ export class VideoService {
266 return feeds 268 return feeds
267 } 269 }
268 270
269 getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter, categoryOneOf?: number[]) { 271 getVideoFeedUrls (sort: VideoSortField, isLocal: boolean, categoryOneOf?: number[]) {
270 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort) 272 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort)
271 273
272 if (filter) params = params.set('filter', filter) 274 if (isLocal) params = params.set('isLocal', isLocal)
273 275
274 if (categoryOneOf) { 276 if (categoryOneOf) {
275 for (const c of categoryOneOf) { 277 for (const c of categoryOneOf) {
@@ -425,7 +427,8 @@ export class VideoService {
425 params, 427 params,
426 videoPagination, 428 videoPagination,
427 sort, 429 sort,
428 filter, 430 isLocal,
431 include,
429 categoryOneOf, 432 categoryOneOf,
430 languageOneOf, 433 languageOneOf,
431 skipCount, 434 skipCount,
@@ -440,9 +443,10 @@ export class VideoService {
440 443
441 let newParams = this.restService.addRestGetParams(params, pagination, sort) 444 let newParams = this.restService.addRestGetParams(params, pagination, sort)
442 445
443 if (filter) newParams = newParams.set('filter', filter)
444 if (skipCount) newParams = newParams.set('skipCount', skipCount + '') 446 if (skipCount) newParams = newParams.set('skipCount', skipCount + '')
445 447
448 if (isLocal) newParams = newParams.set('isLocal', isLocal)
449 if (include) newParams = newParams.set('include', include)
446 if (isLive) newParams = newParams.set('isLive', isLive) 450 if (isLive) newParams = newParams.set('isLive', isLive)
447 if (nsfw) newParams = newParams.set('nsfw', nsfw) 451 if (nsfw) newParams = newParams.set('nsfw', nsfw)
448 if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy)) 452 if (nsfwPolicy) newParams = newParams.set('nsfw', this.nsfwPolicyToParam(nsfwPolicy))
@@ -454,13 +458,9 @@ export class VideoService {
454 458
455 private buildAdminParamsFromSearch (search: string, params: HttpParams) { 459 private buildAdminParamsFromSearch (search: string, params: HttpParams) {
456 const filters = this.restService.parseQueryStringFilter(search, { 460 const filters = this.restService.parseQueryStringFilter(search, {
457 filter: { 461 isLocal: {
458 prefix: 'local:', 462 prefix: 'isLocal:',
459 handler: v => { 463 isBoolean: true
460 if (v === 'true') return 'all-local'
461
462 return 'all'
463 }
464 } 464 }
465 }) 465 })
466 466
diff --git a/client/src/app/shared/shared-moderation/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts
index f6c29dcfa..a6180dd14 100644
--- a/client/src/app/shared/shared-moderation/video-block.component.ts
+++ b/client/src/app/shared/shared-moderation/video-block.component.ts
@@ -61,7 +61,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit {
61 this.hide() 61 this.hide()
62 62
63 this.video.blacklisted = true 63 this.video.blacklisted = true
64 this.video.blockedReason = reason 64 this.video.blacklistedReason = reason
65 65
66 this.videoBlocked.emit() 66 this.videoBlocked.emit()
67 }, 67 },
diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
index 2ba091438..feac79d4e 100644
--- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts
@@ -188,7 +188,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
188 this.notifier.success($localize`Video ${this.video.name} unblocked.`) 188 this.notifier.success($localize`Video ${this.video.name} unblocked.`)
189 189
190 this.video.blacklisted = false 190 this.video.blacklisted = false
191 this.video.blockedReason = null 191 this.video.blacklistedReason = null
192 192
193 this.videoUnblocked.emit() 193 this.videoUnblocked.emit()
194 }, 194 },
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 920dc826c..5ad7cf3f7 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 @@
1import { intoArray, toBoolean } from '@app/helpers' 1import { intoArray, toBoolean } from '@app/helpers'
2import { AttributesOnly } from '@shared/core-utils' 2import { AttributesOnly } from '@shared/core-utils'
3import { BooleanBothQuery, NSFWPolicyType, VideoFilter, VideoSortField } from '@shared/models' 3import { BooleanBothQuery, NSFWPolicyType, VideoInclude, VideoSortField } from '@shared/models'
4 4
5type VideoFiltersKeys = { 5type VideoFiltersKeys = {
6 [ id in keyof AttributesOnly<VideoFilters> ]: any 6 [ id in keyof AttributesOnly<VideoFilters> ]: any
@@ -196,14 +196,15 @@ export class VideoFilters {
196 } 196 }
197 197
198 toVideosAPIObject () { 198 toVideosAPIObject () {
199 let filter: VideoFilter 199 let isLocal: boolean
200 200 let include: VideoInclude
201 if (this.scope === 'local' && this.allVideos) { 201
202 filter = 'all-local' 202 if (this.scope === 'local') {
203 } else if (this.scope === 'federated' && this.allVideos) { 203 isLocal = true
204 filter = 'all' 204 }
205 } else if (this.scope === 'local') { 205
206 filter = 'local' 206 if (this.allVideos) {
207 include = VideoInclude.NOT_PUBLISHED_STATE | VideoInclude.HIDDEN_PRIVACY
207 } 208 }
208 209
209 let isLive: boolean 210 let isLive: boolean
@@ -216,7 +217,8 @@ export class VideoFilters {
216 languageOneOf: this.languageOneOf, 217 languageOneOf: this.languageOneOf,
217 categoryOneOf: this.categoryOneOf, 218 categoryOneOf: this.categoryOneOf,
218 search: this.search, 219 search: this.search,
219 filter, 220 isLocal,
221 include,
220 isLive 222 isLive
221 } 223 }
222 } 224 }
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.html b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
index b12495f90..30483831a 100644
--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.html
+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.html
@@ -55,7 +55,7 @@
55 55
56 <div *ngIf="displayOptions.blacklistInfo && video.blacklisted" class="video-info-blocked"> 56 <div *ngIf="displayOptions.blacklistInfo && video.blacklisted" class="video-info-blocked">
57 <span class="blocked-label" i18n>Blocked</span> 57 <span class="blocked-label" i18n>Blocked</span>
58 <span class="blocked-reason" *ngIf="video.blockedReason">{{ video.blockedReason }}</span> 58 <span class="blocked-reason" *ngIf="video.blacklistedReason">{{ video.blacklistedReason }}</span>
59 </div> 59 </div>
60 60
61 <div i18n *ngIf="displayOptions.nsfw && video.nsfw" class="video-info-nsfw"> 61 <div i18n *ngIf="displayOptions.nsfw && video.nsfw" class="video-info-nsfw">