diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-05 10:52:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-05 10:53:09 +0200 |
commit | 3a0fb65c61f80b510bce979a45d59d17948745e8 (patch) | |
tree | c1be0b2158a008fea826835c8d2fd4e8d648bae9 /client/src/app/videos/+video-watch/modal/video-blacklist.component.ts | |
parent | 693263e936763a851e3c8c020e3739def8bd4eca (diff) | |
download | PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.tar.gz PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.tar.zst PeerTube-3a0fb65c61f80b510bce979a45d59d17948745e8.zip |
Add video miniature dropdown
Diffstat (limited to 'client/src/app/videos/+video-watch/modal/video-blacklist.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/modal/video-blacklist.component.ts | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts b/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts deleted file mode 100644 index 50a7cadd1..000000000 --- a/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | ||
2 | import { Notifier, RedirectService } from '@app/core' | ||
3 | import { FormReactive, VideoBlacklistService, VideoBlacklistValidatorsService } from '../../../shared/index' | ||
4 | import { VideoDetails } from '../../../shared/video/video-details.model' | ||
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | ||
8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-video-blacklist', | ||
12 | templateUrl: './video-blacklist.component.html', | ||
13 | styleUrls: [ './video-blacklist.component.scss' ] | ||
14 | }) | ||
15 | export class VideoBlacklistComponent extends FormReactive implements OnInit { | ||
16 | @Input() video: VideoDetails = null | ||
17 | |||
18 | @ViewChild('modal') modal: NgbModal | ||
19 | |||
20 | error: string = null | ||
21 | |||
22 | private openedModal: NgbModalRef | ||
23 | |||
24 | constructor ( | ||
25 | protected formValidatorService: FormValidatorService, | ||
26 | private modalService: NgbModal, | ||
27 | private videoBlacklistValidatorsService: VideoBlacklistValidatorsService, | ||
28 | private videoBlacklistService: VideoBlacklistService, | ||
29 | private notifier: Notifier, | ||
30 | private redirectService: RedirectService, | ||
31 | private i18n: I18n | ||
32 | ) { | ||
33 | super() | ||
34 | } | ||
35 | |||
36 | ngOnInit () { | ||
37 | const defaultValues = { unfederate: 'true' } | ||
38 | |||
39 | this.buildForm({ | ||
40 | reason: this.videoBlacklistValidatorsService.VIDEO_BLACKLIST_REASON, | ||
41 | unfederate: null | ||
42 | }, defaultValues) | ||
43 | } | ||
44 | |||
45 | show () { | ||
46 | this.openedModal = this.modalService.open(this.modal, { keyboard: false }) | ||
47 | } | ||
48 | |||
49 | hide () { | ||
50 | this.openedModal.close() | ||
51 | this.openedModal = null | ||
52 | } | ||
53 | |||
54 | blacklist () { | ||
55 | const reason = this.form.value[ 'reason' ] || undefined | ||
56 | const unfederate = this.video.isLocal ? this.form.value[ 'unfederate' ] : undefined | ||
57 | |||
58 | this.videoBlacklistService.blacklistVideo(this.video.id, reason, unfederate) | ||
59 | .subscribe( | ||
60 | () => { | ||
61 | this.notifier.success(this.i18n('Video blacklisted.')) | ||
62 | this.hide() | ||
63 | this.redirectService.redirectToHomepage() | ||
64 | }, | ||
65 | |||
66 | err => this.notifier.error(err.message) | ||
67 | ) | ||
68 | } | ||
69 | } | ||