diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-01 16:05:30 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-10 14:02:41 +0200 |
commit | d95d15598847c7f020aa056e7e6e0c02d2bbf732 (patch) | |
tree | a8a593f1269688caf9e5f99559996f346290fec5 /client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts | |
parent | 72493e44e9b455a04c4f093ed6c6ffa300b98d8b (diff) | |
download | PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.gz PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.tar.zst PeerTube-d95d15598847c7f020aa056e7e6e0c02d2bbf732.zip |
Use 3 tables to represent abuses
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts deleted file mode 100644 index 3cd763ca4..000000000 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | ||
2 | import { Notifier } from '@app/core' | ||
3 | import { FormReactive, FormValidatorService, VideoAbuseValidatorsService } from '@app/shared/shared-forms' | ||
4 | import { VideoAbuseService } from '@app/shared/shared-moderation' | ||
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | ||
6 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | ||
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { VideoAbuse } from '@shared/models' | ||
9 | |||
10 | @Component({ | ||
11 | selector: 'my-moderation-comment-modal', | ||
12 | templateUrl: './moderation-comment-modal.component.html', | ||
13 | styleUrls: [ './moderation-comment-modal.component.scss' ] | ||
14 | }) | ||
15 | export class ModerationCommentModalComponent extends FormReactive implements OnInit { | ||
16 | @ViewChild('modal', { static: true }) modal: NgbModal | ||
17 | @Output() commentUpdated = new EventEmitter<string>() | ||
18 | |||
19 | private abuseToComment: VideoAbuse | ||
20 | private openedModal: NgbModalRef | ||
21 | |||
22 | constructor ( | ||
23 | protected formValidatorService: FormValidatorService, | ||
24 | private modalService: NgbModal, | ||
25 | private notifier: Notifier, | ||
26 | private videoAbuseService: VideoAbuseService, | ||
27 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, | ||
28 | private i18n: I18n | ||
29 | ) { | ||
30 | super() | ||
31 | } | ||
32 | |||
33 | ngOnInit () { | ||
34 | this.buildForm({ | ||
35 | moderationComment: this.videoAbuseValidatorsService.VIDEO_ABUSE_MODERATION_COMMENT | ||
36 | }) | ||
37 | } | ||
38 | |||
39 | openModal (abuseToComment: VideoAbuse) { | ||
40 | this.abuseToComment = abuseToComment | ||
41 | this.openedModal = this.modalService.open(this.modal, { centered: true }) | ||
42 | |||
43 | this.form.patchValue({ | ||
44 | moderationComment: this.abuseToComment.moderationComment | ||
45 | }) | ||
46 | } | ||
47 | |||
48 | hide () { | ||
49 | this.abuseToComment = undefined | ||
50 | this.openedModal.close() | ||
51 | this.form.reset() | ||
52 | } | ||
53 | |||
54 | async banUser () { | ||
55 | const moderationComment: string = this.form.value[ 'moderationComment' ] | ||
56 | |||
57 | this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment }) | ||
58 | .subscribe( | ||
59 | () => { | ||
60 | this.notifier.success(this.i18n('Comment updated.')) | ||
61 | |||
62 | this.commentUpdated.emit(moderationComment) | ||
63 | this.hide() | ||
64 | }, | ||
65 | |||
66 | err => this.notifier.error(err.message) | ||
67 | ) | ||
68 | } | ||
69 | |||
70 | } | ||