diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts | 53 |
1 files changed, 28 insertions, 25 deletions
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 3d1fc8690..39358e08b 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 | |||
@@ -1,10 +1,18 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' |
2 | import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' | 2 | import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core' |
3 | import { VideoBlockComponent, VideoBlockService, VideoReportComponent, BlocklistService } from '@app/shared/shared-moderation' | 3 | import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation' |
4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { VideoCaption } from '@shared/models' | 5 | import { VideoCaption } from '@shared/models' |
7 | import { DropdownAction, DropdownButtonSize, DropdownDirection, RedundancyService, Video, VideoDetails, VideoService, Actor } from '../shared-main' | 6 | import { |
7 | Actor, | ||
8 | DropdownAction, | ||
9 | DropdownButtonSize, | ||
10 | DropdownDirection, | ||
11 | RedundancyService, | ||
12 | Video, | ||
13 | VideoDetails, | ||
14 | VideoService | ||
15 | } from '../shared-main' | ||
8 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' | 16 | import { VideoAddToPlaylistComponent } from '../shared-video-playlist' |
9 | import { VideoDownloadComponent } from './video-download.component' | 17 | import { VideoDownloadComponent } from './video-download.component' |
10 | 18 | ||
@@ -71,8 +79,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
71 | private videoBlocklistService: VideoBlockService, | 79 | private videoBlocklistService: VideoBlockService, |
72 | private screenService: ScreenService, | 80 | private screenService: ScreenService, |
73 | private videoService: VideoService, | 81 | private videoService: VideoService, |
74 | private redundancyService: RedundancyService, | 82 | private redundancyService: RedundancyService |
75 | private i18n: I18n | ||
76 | ) { } | 83 | ) { } |
77 | 84 | ||
78 | get user () { | 85 | get user () { |
@@ -153,17 +160,15 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
153 | /* Action handlers */ | 160 | /* Action handlers */ |
154 | 161 | ||
155 | async unblockVideo () { | 162 | async unblockVideo () { |
156 | const confirmMessage = this.i18n( | 163 | const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.` |
157 | 'Do you really want to unblock this video? It will be available again in the videos list.' | ||
158 | ) | ||
159 | 164 | ||
160 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock')) | 165 | const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`) |
161 | if (res === false) return | 166 | if (res === false) return |
162 | 167 | ||
163 | this.videoBlocklistService.unblockVideo(this.video.id) | 168 | this.videoBlocklistService.unblockVideo(this.video.id) |
164 | .subscribe( | 169 | .subscribe( |
165 | () => { | 170 | () => { |
166 | this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: this.video.name })) | 171 | this.notifier.success($localize`Video ${this.video.name} unblocked.`) |
167 | 172 | ||
168 | this.video.blacklisted = false | 173 | this.video.blacklisted = false |
169 | this.video.blockedReason = null | 174 | this.video.blockedReason = null |
@@ -178,14 +183,13 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
178 | async removeVideo () { | 183 | async removeVideo () { |
179 | this.modalOpened.emit() | 184 | this.modalOpened.emit() |
180 | 185 | ||
181 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) | 186 | const res = await this.confirmService.confirm($localize`Do you really want to delete this video?`, $localize`Delete`) |
182 | if (res === false) return | 187 | if (res === false) return |
183 | 188 | ||
184 | this.videoService.removeVideo(this.video.id) | 189 | this.videoService.removeVideo(this.video.id) |
185 | .subscribe( | 190 | .subscribe( |
186 | () => { | 191 | () => { |
187 | this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name })) | 192 | this.notifier.success($localize`Video ${this.video.name} deleted.`) |
188 | |||
189 | this.videoRemoved.emit() | 193 | this.videoRemoved.emit() |
190 | }, | 194 | }, |
191 | 195 | ||
@@ -197,7 +201,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
197 | this.redundancyService.addVideoRedundancy(this.video) | 201 | this.redundancyService.addVideoRedundancy(this.video) |
198 | .subscribe( | 202 | .subscribe( |
199 | () => { | 203 | () => { |
200 | const message = this.i18n('This video will be duplicated by your instance.') | 204 | const message = $localize`This video will be duplicated by your instance.` |
201 | this.notifier.success(message) | 205 | this.notifier.success(message) |
202 | }, | 206 | }, |
203 | 207 | ||
@@ -211,8 +215,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
211 | this.blocklistService.blockAccountByUser(params) | 215 | this.blocklistService.blockAccountByUser(params) |
212 | .subscribe( | 216 | .subscribe( |
213 | () => { | 217 | () => { |
214 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', params)) | 218 | this.notifier.success($localize`Account ${params.nameWithHost} muted.`) |
215 | |||
216 | this.videoAccountMuted.emit() | 219 | this.videoAccountMuted.emit() |
217 | }, | 220 | }, |
218 | 221 | ||
@@ -236,7 +239,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
236 | this.videoActions = [ | 239 | this.videoActions = [ |
237 | [ | 240 | [ |
238 | { | 241 | { |
239 | label: this.i18n('Save to playlist'), | 242 | label: $localize`Save to playlist`, |
240 | handler: () => this.playlistDropdown.toggle(), | 243 | handler: () => this.playlistDropdown.toggle(), |
241 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist, | 244 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist, |
242 | iconName: 'playlist-add' | 245 | iconName: 'playlist-add' |
@@ -244,43 +247,43 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
244 | ], | 247 | ], |
245 | [ // actions regarding the video | 248 | [ // actions regarding the video |
246 | { | 249 | { |
247 | label: this.i18n('Download'), | 250 | label: $localize`Download`, |
248 | handler: () => this.showDownloadModal(), | 251 | handler: () => this.showDownloadModal(), |
249 | isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(), | 252 | isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(), |
250 | iconName: 'download' | 253 | iconName: 'download' |
251 | }, | 254 | }, |
252 | { | 255 | { |
253 | label: this.i18n('Update'), | 256 | label: $localize`Update`, |
254 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], | 257 | linkBuilder: ({ video }) => [ '/videos/update', video.uuid ], |
255 | iconName: 'edit', | 258 | iconName: 'edit', |
256 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() | 259 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable() |
257 | }, | 260 | }, |
258 | { | 261 | { |
259 | label: this.i18n('Block'), | 262 | label: $localize`Block`, |
260 | handler: () => this.showBlockModal(), | 263 | handler: () => this.showBlockModal(), |
261 | iconName: 'no', | 264 | iconName: 'no', |
262 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable() | 265 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable() |
263 | }, | 266 | }, |
264 | { | 267 | { |
265 | label: this.i18n('Unblock'), | 268 | label: $localize`Unblock`, |
266 | handler: () => this.unblockVideo(), | 269 | handler: () => this.unblockVideo(), |
267 | iconName: 'undo', | 270 | iconName: 'undo', |
268 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable() | 271 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable() |
269 | }, | 272 | }, |
270 | { | 273 | { |
271 | label: this.i18n('Mirror'), | 274 | label: $localize`Mirror`, |
272 | handler: () => this.duplicateVideo(), | 275 | handler: () => this.duplicateVideo(), |
273 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(), | 276 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(), |
274 | iconName: 'cloud-download' | 277 | iconName: 'cloud-download' |
275 | }, | 278 | }, |
276 | { | 279 | { |
277 | label: this.i18n('Delete'), | 280 | label: $localize`Delete`, |
278 | handler: () => this.removeVideo(), | 281 | handler: () => this.removeVideo(), |
279 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(), | 282 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(), |
280 | iconName: 'delete' | 283 | iconName: 'delete' |
281 | }, | 284 | }, |
282 | { | 285 | { |
283 | label: this.i18n('Report'), | 286 | label: $localize`Report`, |
284 | handler: () => this.showReportModal(), | 287 | handler: () => this.showReportModal(), |
285 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report, | 288 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report, |
286 | iconName: 'flag' | 289 | iconName: 'flag' |
@@ -288,7 +291,7 @@ export class VideoActionsDropdownComponent implements OnChanges { | |||
288 | ], | 291 | ], |
289 | [ // actions regarding the account/its server | 292 | [ // actions regarding the account/its server |
290 | { | 293 | { |
291 | label: this.i18n('Mute account'), | 294 | label: $localize`Mute account`, |
292 | handler: () => this.muteVideoAccount(), | 295 | handler: () => this.muteVideoAccount(), |
293 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(), | 296 | isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(), |
294 | iconName: 'no' | 297 | iconName: 'no' |