diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-17 11:47:04 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-17 15:12:55 +0200 |
commit | 7ed1edbbe4ffbef28093e4f5630751cb652814e4 (patch) | |
tree | 831862165dbfce593447a517c2294a7a4c28d840 /client/src/app/shared/shared-moderation | |
parent | 1a95f0b9627f8016767a5a386620cbc3335d5f93 (diff) | |
download | PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.tar.gz PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.tar.zst PeerTube-7ed1edbbe4ffbef28093e4f5630751cb652814e4.zip |
We don't need services anymore for validators
Diffstat (limited to 'client/src/app/shared/shared-moderation')
6 files changed, 21 insertions, 21 deletions
diff --git a/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts index 7193ccb1b..6edbb6023 100644 --- a/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts +++ b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { BatchDomainsValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 2 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 4 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
5 | import { DOMAINS_VALIDATOR, getNotEmptyHosts } from '../form-validators/batch-domains-validators' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-batch-domains-modal', | 8 | selector: 'my-batch-domains-modal', |
@@ -18,8 +19,7 @@ export class BatchDomainsModalComponent extends FormReactive implements OnInit { | |||
18 | 19 | ||
19 | constructor ( | 20 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 21 | protected formValidatorService: FormValidatorService, |
21 | private modalService: NgbModal, | 22 | private modalService: NgbModal |
22 | private batchDomainsValidatorsService: BatchDomainsValidatorsService | ||
23 | ) { | 23 | ) { |
24 | super() | 24 | super() |
25 | } | 25 | } |
@@ -28,7 +28,7 @@ export class BatchDomainsModalComponent extends FormReactive implements OnInit { | |||
28 | if (!this.action) this.action = $localize`Process domains` | 28 | if (!this.action) this.action = $localize`Process domains` |
29 | 29 | ||
30 | this.buildForm({ | 30 | this.buildForm({ |
31 | domains: this.batchDomainsValidatorsService.DOMAINS | 31 | domains: DOMAINS_VALIDATOR |
32 | }) | 32 | }) |
33 | } | 33 | } |
34 | 34 | ||
@@ -42,7 +42,7 @@ export class BatchDomainsModalComponent extends FormReactive implements OnInit { | |||
42 | 42 | ||
43 | submit () { | 43 | submit () { |
44 | this.domains.emit( | 44 | this.domains.emit( |
45 | this.batchDomainsValidatorsService.getNotEmptyHosts(this.form.controls['domains'].value) | 45 | getNotEmptyHosts(this.form.controls['domains'].value) |
46 | ) | 46 | ) |
47 | this.form.reset() | 47 | this.form.reset() |
48 | this.hide() | 48 | this.hide() |
diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts index 8ab2fe940..cc8875f77 100644 --- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { mapValues, pickBy } from 'lodash-es' | 1 | import { mapValues, pickBy } from 'lodash-es' |
2 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier } from '@app/core' |
4 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators' |
5 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
5 | import { Account } from '@app/shared/shared-main' | 6 | import { Account } from '@app/shared/shared-main' |
6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
7 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
@@ -28,7 +29,6 @@ export class AccountReportComponent extends FormReactive implements OnInit { | |||
28 | constructor ( | 29 | constructor ( |
29 | protected formValidatorService: FormValidatorService, | 30 | protected formValidatorService: FormValidatorService, |
30 | private modalService: NgbModal, | 31 | private modalService: NgbModal, |
31 | private abuseValidatorsService: AbuseValidatorsService, | ||
32 | private abuseService: AbuseService, | 32 | private abuseService: AbuseService, |
33 | private notifier: Notifier | 33 | private notifier: Notifier |
34 | ) { | 34 | ) { |
@@ -51,7 +51,7 @@ export class AccountReportComponent extends FormReactive implements OnInit { | |||
51 | this.modalTitle = $localize`Report ${this.account.displayName}` | 51 | this.modalTitle = $localize`Report ${this.account.displayName}` |
52 | 52 | ||
53 | this.buildForm({ | 53 | this.buildForm({ |
54 | reason: this.abuseValidatorsService.ABUSE_REASON, | 54 | reason: ABUSE_REASON_VALIDATOR, |
55 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null) | 55 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null) |
56 | }) | 56 | }) |
57 | 57 | ||
diff --git a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts index d75f4d717..c7395c7b7 100644 --- a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { mapValues, pickBy } from 'lodash-es' | 1 | import { mapValues, pickBy } from 'lodash-es' |
2 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier } from '@app/core' |
4 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators' |
5 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
5 | import { VideoComment } from '@app/shared/shared-video-comment' | 6 | import { VideoComment } from '@app/shared/shared-video-comment' |
6 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
7 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
@@ -28,7 +29,6 @@ export class CommentReportComponent extends FormReactive implements OnInit { | |||
28 | constructor ( | 29 | constructor ( |
29 | protected formValidatorService: FormValidatorService, | 30 | protected formValidatorService: FormValidatorService, |
30 | private modalService: NgbModal, | 31 | private modalService: NgbModal, |
31 | private abuseValidatorsService: AbuseValidatorsService, | ||
32 | private abuseService: AbuseService, | 32 | private abuseService: AbuseService, |
33 | private notifier: Notifier | 33 | private notifier: Notifier |
34 | ) { | 34 | ) { |
@@ -51,7 +51,7 @@ export class CommentReportComponent extends FormReactive implements OnInit { | |||
51 | this.modalTitle = $localize`Report comment` | 51 | this.modalTitle = $localize`Report comment` |
52 | 52 | ||
53 | this.buildForm({ | 53 | this.buildForm({ |
54 | reason: this.abuseValidatorsService.ABUSE_REASON, | 54 | reason: ABUSE_REASON_VALIDATOR, |
55 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null) | 55 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null) |
56 | }) | 56 | }) |
57 | 57 | ||
diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts index edff6d325..5b06c0bc7 100644 --- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts | |||
@@ -3,7 +3,8 @@ import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/uti | |||
3 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 3 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
4 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 4 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 6 | import { ABUSE_REASON_VALIDATOR } from '@app/shared/form-validators/abuse-validators' |
7 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | ||
7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 8 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 9 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
9 | import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' | 10 | import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' |
@@ -30,7 +31,6 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
30 | constructor ( | 31 | constructor ( |
31 | protected formValidatorService: FormValidatorService, | 32 | protected formValidatorService: FormValidatorService, |
32 | private modalService: NgbModal, | 33 | private modalService: NgbModal, |
33 | private abuseValidatorsService: AbuseValidatorsService, | ||
34 | private abuseService: AbuseService, | 34 | private abuseService: AbuseService, |
35 | private notifier: Notifier, | 35 | private notifier: Notifier, |
36 | private sanitizer: DomSanitizer | 36 | private sanitizer: DomSanitizer |
@@ -68,7 +68,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
68 | 68 | ||
69 | ngOnInit () { | 69 | ngOnInit () { |
70 | this.buildForm({ | 70 | this.buildForm({ |
71 | reason: this.abuseValidatorsService.ABUSE_REASON, | 71 | reason: ABUSE_REASON_VALIDATOR, |
72 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null), | 72 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null), |
73 | timestamp: { | 73 | timestamp: { |
74 | hasStart: null, | 74 | hasStart: null, |
diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts index f9a0381c5..afc69a1b8 100644 --- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts | |||
@@ -1,9 +1,10 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 2 | import { Notifier, UserService } from '@app/core' |
3 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
6 | import { User } from '@shared/models' | 6 | import { User } from '@shared/models' |
7 | import { USER_BAN_REASON_VALIDATOR } from '../form-validators/user-validators' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-user-ban-modal', | 10 | selector: 'my-user-ban-modal', |
@@ -21,15 +22,14 @@ export class UserBanModalComponent extends FormReactive implements OnInit { | |||
21 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
22 | private modalService: NgbModal, | 23 | private modalService: NgbModal, |
23 | private notifier: Notifier, | 24 | private notifier: Notifier, |
24 | private userService: UserService, | 25 | private userService: UserService |
25 | private userValidatorsService: UserValidatorsService | ||
26 | ) { | 26 | ) { |
27 | super() | 27 | super() |
28 | } | 28 | } |
29 | 29 | ||
30 | ngOnInit () { | 30 | ngOnInit () { |
31 | this.buildForm({ | 31 | this.buildForm({ |
32 | reason: this.userValidatorsService.USER_BAN_REASON | 32 | reason: USER_BAN_REASON_VALIDATOR |
33 | }) | 33 | }) |
34 | } | 34 | } |
35 | 35 | ||
diff --git a/client/src/app/shared/shared-moderation/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts index 2bef9efdd..fb47989dc 100644 --- a/client/src/app/shared/shared-moderation/video-block.component.ts +++ b/client/src/app/shared/shared-moderation/video-block.component.ts | |||
@@ -1,9 +1,10 @@ | |||
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 } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, FormValidatorService, VideoBlockValidatorsService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
4 | import { Video } from '@app/shared/shared-main' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 6 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
7 | import { VIDEO_BLOCK_REASON_VALIDATOR } from '../form-validators/video-block-validators' | ||
7 | import { VideoBlockService } from './video-block.service' | 8 | import { VideoBlockService } from './video-block.service' |
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
@@ -25,7 +26,6 @@ export class VideoBlockComponent extends FormReactive implements OnInit { | |||
25 | constructor ( | 26 | constructor ( |
26 | protected formValidatorService: FormValidatorService, | 27 | protected formValidatorService: FormValidatorService, |
27 | private modalService: NgbModal, | 28 | private modalService: NgbModal, |
28 | private videoBlockValidatorsService: VideoBlockValidatorsService, | ||
29 | private videoBlocklistService: VideoBlockService, | 29 | private videoBlocklistService: VideoBlockService, |
30 | private notifier: Notifier | 30 | private notifier: Notifier |
31 | ) { | 31 | ) { |
@@ -36,7 +36,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit { | |||
36 | const defaultValues = { unfederate: 'true' } | 36 | const defaultValues = { unfederate: 'true' } |
37 | 37 | ||
38 | this.buildForm({ | 38 | this.buildForm({ |
39 | reason: this.videoBlockValidatorsService.VIDEO_BLOCK_REASON, | 39 | reason: VIDEO_BLOCK_REASON_VALIDATOR, |
40 | unfederate: null | 40 | unfederate: null |
41 | }, defaultValues) | 41 | }, defaultValues) |
42 | } | 42 | } |