diff options
Diffstat (limited to 'client/src/app/shared/video/modals')
-rw-r--r-- | client/src/app/shared/video/modals/video-block.component.html (renamed from client/src/app/shared/video/modals/video-blacklist.component.html) | 4 | ||||
-rw-r--r-- | client/src/app/shared/video/modals/video-block.component.scss (renamed from client/src/app/shared/video/modals/video-blacklist.component.scss) | 0 | ||||
-rw-r--r-- | client/src/app/shared/video/modals/video-block.component.ts (renamed from client/src/app/shared/video/modals/video-blacklist.component.ts) | 31 |
3 files changed, 17 insertions, 18 deletions
diff --git a/client/src/app/shared/video/modals/video-blacklist.component.html b/client/src/app/shared/video/modals/video-block.component.html index 8f06a6b02..a8dd30b5e 100644 --- a/client/src/app/shared/video/modals/video-blacklist.component.html +++ b/client/src/app/shared/video/modals/video-block.component.html | |||
@@ -1,12 +1,12 @@ | |||
1 | <ng-template #modal> | 1 | <ng-template #modal> |
2 | <div class="modal-header"> | 2 | <div class="modal-header"> |
3 | <h4 i18n class="modal-title">Blacklist video</h4> | 3 | <h4 i18n class="modal-title">Blocklist video</h4> |
4 | <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> | 4 | <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> |
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <div class="modal-body"> | 7 | <div class="modal-body"> |
8 | 8 | ||
9 | <form novalidate [formGroup]="form" (ngSubmit)="blacklist()"> | 9 | <form novalidate [formGroup]="form" (ngSubmit)="block()"> |
10 | <div class="form-group"> | 10 | <div class="form-group"> |
11 | <textarea | 11 | <textarea |
12 | i18n-placeholder placeholder="Reason..." formControlName="reason" | 12 | i18n-placeholder placeholder="Reason..." formControlName="reason" |
diff --git a/client/src/app/shared/video/modals/video-blacklist.component.scss b/client/src/app/shared/video/modals/video-block.component.scss index afcdb9a16..afcdb9a16 100644 --- a/client/src/app/shared/video/modals/video-blacklist.component.scss +++ b/client/src/app/shared/video/modals/video-block.component.scss | |||
diff --git a/client/src/app/shared/video/modals/video-blacklist.component.ts b/client/src/app/shared/video/modals/video-block.component.ts index 6ef9c250b..1a25e0578 100644 --- a/client/src/app/shared/video/modals/video-blacklist.component.ts +++ b/client/src/app/shared/video/modals/video-block.component.ts | |||
@@ -1,24 +1,24 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Notifier, RedirectService } from '@app/core' | 2 | import { Notifier, RedirectService } from '@app/core' |
3 | import { VideoBlacklistService } from '../../../shared/video-blacklist' | 3 | import { VideoBlockService } from '../../video-block' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 5 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
7 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 7 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
8 | import { FormReactive, VideoBlacklistValidatorsService } from '@app/shared/forms' | 8 | import { FormReactive, VideoBlockValidatorsService } from '@app/shared/forms' |
9 | import { Video } from '@app/shared/video/video.model' | 9 | import { Video } from '@app/shared/video/video.model' |
10 | 10 | ||
11 | @Component({ | 11 | @Component({ |
12 | selector: 'my-video-blacklist', | 12 | selector: 'my-video-block', |
13 | templateUrl: './video-blacklist.component.html', | 13 | templateUrl: './video-block.component.html', |
14 | styleUrls: [ './video-blacklist.component.scss' ] | 14 | styleUrls: [ './video-block.component.scss' ] |
15 | }) | 15 | }) |
16 | export class VideoBlacklistComponent extends FormReactive implements OnInit { | 16 | export class VideoBlockComponent extends FormReactive implements OnInit { |
17 | @Input() video: Video = null | 17 | @Input() video: Video = null |
18 | 18 | ||
19 | @ViewChild('modal', { static: true }) modal: NgbModal | 19 | @ViewChild('modal', { static: true }) modal: NgbModal |
20 | 20 | ||
21 | @Output() videoBlacklisted = new EventEmitter() | 21 | @Output() videoBlocked = new EventEmitter() |
22 | 22 | ||
23 | error: string = null | 23 | error: string = null |
24 | 24 | ||
@@ -27,10 +27,9 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { | |||
27 | constructor ( | 27 | constructor ( |
28 | protected formValidatorService: FormValidatorService, | 28 | protected formValidatorService: FormValidatorService, |
29 | private modalService: NgbModal, | 29 | private modalService: NgbModal, |
30 | private videoBlacklistValidatorsService: VideoBlacklistValidatorsService, | 30 | private videoBlockValidatorsService: VideoBlockValidatorsService, |
31 | private videoBlacklistService: VideoBlacklistService, | 31 | private videoBlocklistService: VideoBlockService, |
32 | private notifier: Notifier, | 32 | private notifier: Notifier, |
33 | private redirectService: RedirectService, | ||
34 | private i18n: I18n | 33 | private i18n: I18n |
35 | ) { | 34 | ) { |
36 | super() | 35 | super() |
@@ -40,7 +39,7 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { | |||
40 | const defaultValues = { unfederate: 'true' } | 39 | const defaultValues = { unfederate: 'true' } |
41 | 40 | ||
42 | this.buildForm({ | 41 | this.buildForm({ |
43 | reason: this.videoBlacklistValidatorsService.VIDEO_BLACKLIST_REASON, | 42 | reason: this.videoBlockValidatorsService.VIDEO_BLOCK_REASON, |
44 | unfederate: null | 43 | unfederate: null |
45 | }, defaultValues) | 44 | }, defaultValues) |
46 | } | 45 | } |
@@ -54,20 +53,20 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { | |||
54 | this.openedModal = null | 53 | this.openedModal = null |
55 | } | 54 | } |
56 | 55 | ||
57 | blacklist () { | 56 | block () { |
58 | const reason = this.form.value[ 'reason' ] || undefined | 57 | const reason = this.form.value[ 'reason' ] || undefined |
59 | const unfederate = this.video.isLocal ? this.form.value[ 'unfederate' ] : undefined | 58 | const unfederate = this.video.isLocal ? this.form.value[ 'unfederate' ] : undefined |
60 | 59 | ||
61 | this.videoBlacklistService.blacklistVideo(this.video.id, reason, unfederate) | 60 | this.videoBlocklistService.blockVideo(this.video.id, reason, unfederate) |
62 | .subscribe( | 61 | .subscribe( |
63 | () => { | 62 | () => { |
64 | this.notifier.success(this.i18n('Video blacklisted.')) | 63 | this.notifier.success(this.i18n('Video blocked.')) |
65 | this.hide() | 64 | this.hide() |
66 | 65 | ||
67 | this.video.blacklisted = true | 66 | this.video.blacklisted = true |
68 | this.video.blacklistedReason = reason | 67 | this.video.blockedReason = reason |
69 | 68 | ||
70 | this.videoBlacklisted.emit() | 69 | this.videoBlocked.emit() |
71 | }, | 70 | }, |
72 | 71 | ||
73 | err => this.notifier.error(err.message) | 72 | err => this.notifier.error(err.message) |