diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index 422d873c0..2b1ef663c 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -1,15 +1,14 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { filter, switchMap } from 'rxjs/operators' | 2 | import { filter, switchMap } from 'rxjs/operators' |
3 | import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' | ||
4 | import { environment } from 'src/environments/environment' | ||
3 | import { AfterViewInit, Component, OnInit } from '@angular/core' | 5 | import { AfterViewInit, Component, OnInit } from '@angular/core' |
6 | import { DomSanitizer } from '@angular/platform-browser' | ||
4 | import { ActivatedRoute, Params, Router } from '@angular/router' | 7 | import { ActivatedRoute, Params, Router } from '@angular/router' |
5 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
6 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
7 | import { VideoBlockService } from '@app/shared/shared-moderation' | 10 | import { VideoBlockService } from '@app/shared/shared-moderation' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' | 11 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' |
10 | import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils' | ||
11 | import { environment } from 'src/environments/environment' | ||
12 | import { DomSanitizer } from '@angular/platform-browser' | ||
13 | 12 | ||
14 | @Component({ | 13 | @Component({ |
15 | selector: 'my-video-block-list', | 14 | selector: 'my-video-block-list', |
@@ -34,26 +33,25 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
34 | private sanitizer: DomSanitizer, | 33 | private sanitizer: DomSanitizer, |
35 | private videoService: VideoService, | 34 | private videoService: VideoService, |
36 | private route: ActivatedRoute, | 35 | private route: ActivatedRoute, |
37 | private router: Router, | 36 | private router: Router |
38 | private i18n: I18n | 37 | ) { |
39 | ) { | ||
40 | super() | 38 | super() |
41 | 39 | ||
42 | this.videoBlocklistActions = [ | 40 | this.videoBlocklistActions = [ |
43 | [ | 41 | [ |
44 | { | 42 | { |
45 | label: this.i18n('Internal actions'), | 43 | label: $localize`Internal actions`, |
46 | isHeader: true, | 44 | isHeader: true, |
47 | isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED | 45 | isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED |
48 | }, | 46 | }, |
49 | { | 47 | { |
50 | label: this.i18n('Switch video block to manual'), | 48 | label: $localize`Switch video block to manual`, |
51 | handler: videoBlock => { | 49 | handler: videoBlock => { |
52 | this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe( | 50 | this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe( |
53 | switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true)) | 51 | switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true)) |
54 | ).subscribe( | 52 | ).subscribe( |
55 | () => { | 53 | () => { |
56 | this.notifier.success(this.i18n('Video {{name}} switched to manual block.', { name: videoBlock.video.name })) | 54 | this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) |
57 | this.loadData() | 55 | this.loadData() |
58 | }, | 56 | }, |
59 | 57 | ||
@@ -65,27 +63,27 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
65 | ], | 63 | ], |
66 | [ | 64 | [ |
67 | { | 65 | { |
68 | label: this.i18n('Actions for the video'), | 66 | label: $localize`Actions for the video`, |
69 | isHeader: true | 67 | isHeader: true |
70 | }, | 68 | }, |
71 | { | 69 | { |
72 | label: this.i18n('Unblock'), | 70 | label: $localize`Unblock`, |
73 | handler: videoBlock => this.unblockVideo(videoBlock) | 71 | handler: videoBlock => this.unblockVideo(videoBlock) |
74 | }, | 72 | }, |
75 | 73 | ||
76 | { | 74 | { |
77 | label: this.i18n('Delete'), | 75 | label: $localize`Delete`, |
78 | handler: async videoBlock => { | 76 | handler: async videoBlock => { |
79 | const res = await this.confirmService.confirm( | 77 | const res = await this.confirmService.confirm( |
80 | this.i18n('Do you really want to delete this video?'), | 78 | $localize`Do you really want to delete this video?`, |
81 | this.i18n('Delete') | 79 | $localize`Delete` |
82 | ) | 80 | ) |
83 | if (res === false) return | 81 | if (res === false) return |
84 | 82 | ||
85 | this.videoService.removeVideo(videoBlock.video.id) | 83 | this.videoService.removeVideo(videoBlock.video.id) |
86 | .subscribe( | 84 | .subscribe( |
87 | () => { | 85 | () => { |
88 | this.notifier.success(this.i18n('Video deleted.')) | 86 | this.notifier.success($localize`Video deleted.`) |
89 | }, | 87 | }, |
90 | 88 | ||
91 | err => this.notifier.error(err.message) | 89 | err => this.notifier.error(err.message) |
@@ -148,9 +146,9 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
148 | } | 146 | } |
149 | 147 | ||
150 | booleanToText (value: boolean) { | 148 | booleanToText (value: boolean) { |
151 | if (value === true) return this.i18n('yes') | 149 | if (value === true) return $localize`yes` |
152 | 150 | ||
153 | return this.i18n('no') | 151 | return $localize`no` |
154 | } | 152 | } |
155 | 153 | ||
156 | toHtml (text: string) { | 154 | toHtml (text: string) { |
@@ -158,16 +156,14 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
158 | } | 156 | } |
159 | 157 | ||
160 | async unblockVideo (entry: VideoBlacklist) { | 158 | async unblockVideo (entry: VideoBlacklist) { |
161 | const confirmMessage = this.i18n( | 159 | const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.` |
162 | 'Do you really want to unblock this video? It will be available again in the videos list.' | ||
163 | ) | ||
164 | 160 | ||
165 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock')) | 161 | const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`) |
166 | if (res === false) return | 162 | if (res === false) return |
167 | 163 | ||
168 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( | 164 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( |
169 | () => { | 165 | () => { |
170 | this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: entry.video.name })) | 166 | this.notifier.success($localize`Video ${entry.video.name} unblocked.`) |
171 | this.loadData() | 167 | this.loadData() |
172 | }, | 168 | }, |
173 | 169 | ||