aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/overview/videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/overview/videos')
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.html2
-rw-r--r--client/src/app/+admin/overview/videos/video-list.component.ts36
2 files changed, 35 insertions, 3 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 6b0dc3abd..9b536ec11 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.html
+++ b/client/src/app/+admin/overview/videos/video-list.component.html
@@ -126,3 +126,5 @@
126 </tr> 126 </tr>
127 </ng-template> 127 </ng-template>
128</p-table> 128</p-table>
129
130<my-video-block #videoBlockModal (videoBlocked)="onVideoBlocked()"></my-video-block>
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 0f98a5d33..7f268bb23 100644
--- a/client/src/app/+admin/overview/videos/video-list.component.ts
+++ b/client/src/app/+admin/overview/videos/video-list.component.ts
@@ -1,10 +1,11 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { finalize } from 'rxjs/operators' 2import { finalize } from 'rxjs/operators'
3import { Component, OnInit } from '@angular/core' 3import { Component, OnInit, ViewChild } from '@angular/core'
4import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
5import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 5import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
6import { AdvancedInputFilter } from '@app/shared/shared-forms' 6import { AdvancedInputFilter } from '@app/shared/shared-forms'
7import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' 7import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
8import { VideoBlockComponent, VideoBlockService } from '@app/shared/shared-moderation'
8import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature' 9import { VideoActionsDisplayType } from '@app/shared/shared-video-miniature'
9import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models' 10import { UserRight, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
10import { VideoAdminService } from './video-admin.service' 11import { VideoAdminService } from './video-admin.service'
@@ -15,6 +16,8 @@ import { VideoAdminService } from './video-admin.service'
15 styleUrls: [ './video-list.component.scss' ] 16 styleUrls: [ './video-list.component.scss' ]
16}) 17})
17export class VideoListComponent extends RestTable implements OnInit { 18export class VideoListComponent extends RestTable implements OnInit {
19 @ViewChild('videoBlockModal') videoBlockModal: VideoBlockComponent
20
18 videos: Video[] = [] 21 videos: Video[] = []
19 22
20 totalRecords = 0 23 totalRecords = 0
@@ -48,7 +51,8 @@ export class VideoListComponent extends RestTable implements OnInit {
48 private auth: AuthService, 51 private auth: AuthService,
49 private notifier: Notifier, 52 private notifier: Notifier,
50 private videoService: VideoService, 53 private videoService: VideoService,
51 private videoAdminService: VideoAdminService 54 private videoAdminService: VideoAdminService,
55 private videoBlockService: VideoBlockService
52 ) { 56 ) {
53 super() 57 super()
54 } 58 }
@@ -68,6 +72,16 @@ export class VideoListComponent extends RestTable implements OnInit {
68 label: $localize`Delete`, 72 label: $localize`Delete`,
69 handler: videos => this.removeVideos(videos), 73 handler: videos => this.removeVideos(videos),
70 isDisplayed: () => this.authUser.hasRight(UserRight.REMOVE_ANY_VIDEO) 74 isDisplayed: () => this.authUser.hasRight(UserRight.REMOVE_ANY_VIDEO)
75 },
76 {
77 label: $localize`Block`,
78 handler: videos => this.videoBlockModal.show(videos),
79 isDisplayed: videos => this.authUser.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) && videos.every(v => !v.blacklisted)
80 },
81 {
82 label: $localize`Unblock`,
83 handler: videos => this.unblockVideos(videos),
84 isDisplayed: videos => this.authUser.hasRight(UserRight.MANAGE_VIDEO_BLACKLIST) && videos.every(v => v.blacklisted)
71 } 85 }
72 ] 86 ]
73 ] 87 ]
@@ -132,6 +146,10 @@ export class VideoListComponent extends RestTable implements OnInit {
132 return files.reduce((p, f) => p += f.size, 0) 146 return files.reduce((p, f) => p += f.size, 0)
133 } 147 }
134 148
149 onVideoBlocked () {
150 this.reloadData()
151 }
152
135 protected reloadData () { 153 protected reloadData () {
136 this.selectedVideos = [] 154 this.selectedVideos = []
137 155
@@ -160,7 +178,19 @@ export class VideoListComponent extends RestTable implements OnInit {
160 this.videoService.removeVideo(videos.map(v => v.id)) 178 this.videoService.removeVideo(videos.map(v => v.id))
161 .subscribe({ 179 .subscribe({
162 next: () => { 180 next: () => {
163 this.notifier.success($localize`${videos.length} videos deleted.`) 181 this.notifier.success($localize`Deleted ${videos.length} videos.`)
182 this.reloadData()
183 },
184
185 error: err => this.notifier.error(err.message)
186 })
187 }
188
189 private unblockVideos (videos: Video[]) {
190 this.videoBlockService.unblockVideo(videos.map(v => v.id))
191 .subscribe({
192 next: () => {
193 this.notifier.success($localize`Unblocked ${videos.length} videos.`)
164 this.reloadData() 194 this.reloadData()
165 }, 195 },
166 196