diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts (renamed from client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts) | 10 | ||||
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/index.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/shared-forms/shared-form.module.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/account/actor.model.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/users/user-notification.model.ts | 26 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/users/user-notifications.component.html | 8 | ||||
-rw-r--r-- | client/src/app/shared/shared-moderation/abuse.service.ts (renamed from client/src/app/shared/shared-moderation/video-abuse.service.ts) | 32 | ||||
-rw-r--r-- | client/src/app/shared/shared-moderation/index.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/shared-moderation/shared-moderation.module.ts | 4 | ||||
-rw-r--r-- | client/src/app/shared/shared-moderation/video-report.component.ts | 29 |
10 files changed, 67 insertions, 52 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts index aae56d607..739115e19 100644 --- a/client/src/app/shared/shared-forms/form-validators/video-abuse-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/abuse-validators.service.ts | |||
@@ -4,12 +4,12 @@ import { Injectable } from '@angular/core' | |||
4 | import { BuildFormValidator } from './form-validator.service' | 4 | import { BuildFormValidator } from './form-validator.service' |
5 | 5 | ||
6 | @Injectable() | 6 | @Injectable() |
7 | export class VideoAbuseValidatorsService { | 7 | export class AbuseValidatorsService { |
8 | readonly VIDEO_ABUSE_REASON: BuildFormValidator | 8 | readonly ABUSE_REASON: BuildFormValidator |
9 | readonly VIDEO_ABUSE_MODERATION_COMMENT: BuildFormValidator | 9 | readonly ABUSE_MODERATION_COMMENT: BuildFormValidator |
10 | 10 | ||
11 | constructor (private i18n: I18n) { | 11 | constructor (private i18n: I18n) { |
12 | this.VIDEO_ABUSE_REASON = { | 12 | this.ABUSE_REASON = { |
13 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | 13 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], |
14 | MESSAGES: { | 14 | MESSAGES: { |
15 | 'required': this.i18n('Report reason is required.'), | 15 | 'required': this.i18n('Report reason is required.'), |
@@ -18,7 +18,7 @@ export class VideoAbuseValidatorsService { | |||
18 | } | 18 | } |
19 | } | 19 | } |
20 | 20 | ||
21 | this.VIDEO_ABUSE_MODERATION_COMMENT = { | 21 | this.ABUSE_MODERATION_COMMENT = { |
22 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], | 22 | VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ], |
23 | MESSAGES: { | 23 | MESSAGES: { |
24 | 'required': this.i18n('Moderation comment is required.'), | 24 | 'required': this.i18n('Moderation comment is required.'), |
diff --git a/client/src/app/shared/shared-forms/form-validators/index.ts b/client/src/app/shared/shared-forms/form-validators/index.ts index 8b71841a9..b06a326ff 100644 --- a/client/src/app/shared/shared-forms/form-validators/index.ts +++ b/client/src/app/shared/shared-forms/form-validators/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './abuse-validators.service' | ||
1 | export * from './batch-domains-validators.service' | 2 | export * from './batch-domains-validators.service' |
2 | export * from './custom-config-validators.service' | 3 | export * from './custom-config-validators.service' |
3 | export * from './form-validator.service' | 4 | export * from './form-validator.service' |
@@ -6,7 +7,6 @@ export * from './instance-validators.service' | |||
6 | export * from './login-validators.service' | 7 | export * from './login-validators.service' |
7 | export * from './reset-password-validators.service' | 8 | export * from './reset-password-validators.service' |
8 | export * from './user-validators.service' | 9 | export * from './user-validators.service' |
9 | export * from './video-abuse-validators.service' | ||
10 | export * from './video-accept-ownership-validators.service' | 10 | export * from './video-accept-ownership-validators.service' |
11 | export * from './video-block-validators.service' | 11 | export * from './video-block-validators.service' |
12 | export * from './video-captions-validators.service' | 12 | export * from './video-captions-validators.service' |
diff --git a/client/src/app/shared/shared-forms/shared-form.module.ts b/client/src/app/shared/shared-forms/shared-form.module.ts index e82fa97d4..ba33704cf 100644 --- a/client/src/app/shared/shared-forms/shared-form.module.ts +++ b/client/src/app/shared/shared-forms/shared-form.module.ts | |||
@@ -11,7 +11,7 @@ import { | |||
11 | LoginValidatorsService, | 11 | LoginValidatorsService, |
12 | ResetPasswordValidatorsService, | 12 | ResetPasswordValidatorsService, |
13 | UserValidatorsService, | 13 | UserValidatorsService, |
14 | VideoAbuseValidatorsService, | 14 | AbuseValidatorsService, |
15 | VideoAcceptOwnershipValidatorsService, | 15 | VideoAcceptOwnershipValidatorsService, |
16 | VideoBlockValidatorsService, | 16 | VideoBlockValidatorsService, |
17 | VideoCaptionsValidatorsService, | 17 | VideoCaptionsValidatorsService, |
@@ -69,7 +69,7 @@ import { TimestampInputComponent } from './timestamp-input.component' | |||
69 | LoginValidatorsService, | 69 | LoginValidatorsService, |
70 | ResetPasswordValidatorsService, | 70 | ResetPasswordValidatorsService, |
71 | UserValidatorsService, | 71 | UserValidatorsService, |
72 | VideoAbuseValidatorsService, | 72 | AbuseValidatorsService, |
73 | VideoAcceptOwnershipValidatorsService, | 73 | VideoAcceptOwnershipValidatorsService, |
74 | VideoBlockValidatorsService, | 74 | VideoBlockValidatorsService, |
75 | VideoCaptionsValidatorsService, | 75 | VideoCaptionsValidatorsService, |
diff --git a/client/src/app/shared/shared-main/account/actor.model.ts b/client/src/app/shared/shared-main/account/actor.model.ts index 5fc7989dd..0fa161ce6 100644 --- a/client/src/app/shared/shared-main/account/actor.model.ts +++ b/client/src/app/shared/shared-main/account/actor.model.ts | |||
@@ -14,7 +14,7 @@ export abstract class Actor implements ActorServer { | |||
14 | 14 | ||
15 | avatarUrl: string | 15 | avatarUrl: string |
16 | 16 | ||
17 | static GET_ACTOR_AVATAR_URL (actor: { avatar?: Avatar }) { | 17 | static GET_ACTOR_AVATAR_URL (actor: { avatar?: { url?: string, path: string } }) { |
18 | if (actor?.avatar?.url) return actor.avatar.url | 18 | if (actor?.avatar?.url) return actor.avatar.url |
19 | 19 | ||
20 | if (actor && actor.avatar) { | 20 | if (actor && actor.avatar) { |
diff --git a/client/src/app/shared/shared-main/users/user-notification.model.ts b/client/src/app/shared/shared-main/users/user-notification.model.ts index de25d3ab9..389a242fd 100644 --- a/client/src/app/shared/shared-main/users/user-notification.model.ts +++ b/client/src/app/shared/shared-main/users/user-notification.model.ts | |||
@@ -25,9 +25,20 @@ export class UserNotification implements UserNotificationServer { | |||
25 | video: VideoInfo | 25 | video: VideoInfo |
26 | } | 26 | } |
27 | 27 | ||
28 | videoAbuse?: { | 28 | abuse?: { |
29 | id: number | 29 | id: number |
30 | video: VideoInfo | 30 | |
31 | video?: VideoInfo | ||
32 | |||
33 | comment?: { | ||
34 | threadId: number | ||
35 | |||
36 | video: { | ||
37 | uuid: string | ||
38 | } | ||
39 | } | ||
40 | |||
41 | account?: ActorInfo | ||
31 | } | 42 | } |
32 | 43 | ||
33 | videoBlacklist?: { | 44 | videoBlacklist?: { |
@@ -55,7 +66,7 @@ export class UserNotification implements UserNotificationServer { | |||
55 | // Additional fields | 66 | // Additional fields |
56 | videoUrl?: string | 67 | videoUrl?: string |
57 | commentUrl?: any[] | 68 | commentUrl?: any[] |
58 | videoAbuseUrl?: string | 69 | abuseUrl?: string |
59 | videoAutoBlacklistUrl?: string | 70 | videoAutoBlacklistUrl?: string |
60 | accountUrl?: string | 71 | accountUrl?: string |
61 | videoImportIdentifier?: string | 72 | videoImportIdentifier?: string |
@@ -78,7 +89,7 @@ export class UserNotification implements UserNotificationServer { | |||
78 | this.comment = hash.comment | 89 | this.comment = hash.comment |
79 | if (this.comment) this.setAvatarUrl(this.comment.account) | 90 | if (this.comment) this.setAvatarUrl(this.comment.account) |
80 | 91 | ||
81 | this.videoAbuse = hash.videoAbuse | 92 | this.abuse = hash.abuse |
82 | 93 | ||
83 | this.videoBlacklist = hash.videoBlacklist | 94 | this.videoBlacklist = hash.videoBlacklist |
84 | 95 | ||
@@ -108,8 +119,9 @@ export class UserNotification implements UserNotificationServer { | |||
108 | break | 119 | break |
109 | 120 | ||
110 | case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: | 121 | case UserNotificationType.NEW_VIDEO_ABUSE_FOR_MODERATORS: |
111 | this.videoAbuseUrl = '/admin/moderation/video-abuses/list' | 122 | this.abuseUrl = '/admin/moderation/abuses/list' |
112 | this.videoUrl = this.buildVideoUrl(this.videoAbuse.video) | 123 | |
124 | if (this.abuse.video) this.videoUrl = this.buildVideoUrl(this.abuse.video) | ||
113 | break | 125 | break |
114 | 126 | ||
115 | case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: | 127 | case UserNotificationType.VIDEO_AUTO_BLACKLIST_FOR_MODERATORS: |
@@ -178,7 +190,7 @@ export class UserNotification implements UserNotificationServer { | |||
178 | return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName | 190 | return videoImport.targetUrl || videoImport.magnetUri || videoImport.torrentName |
179 | } | 191 | } |
180 | 192 | ||
181 | private setAvatarUrl (actor: { avatarUrl?: string, avatar?: Avatar }) { | 193 | private setAvatarUrl (actor: { avatarUrl?: string, avatar?: { url?: string, path: string } }) { |
182 | actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) | 194 | actor.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(actor) |
183 | } | 195 | } |
184 | } | 196 | } |
diff --git a/client/src/app/shared/shared-main/users/user-notifications.component.html b/client/src/app/shared/shared-main/users/user-notifications.component.html index d5be1470e..8d31eab0d 100644 --- a/client/src/app/shared/shared-main/users/user-notifications.component.html +++ b/client/src/app/shared/shared-main/users/user-notifications.component.html | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | <ng-template #noVideo> | 20 | <ng-template #noVideo> |
21 | <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> | 21 | <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> |
22 | 22 | ||
23 | <div class="message" i18n> | 23 | <div class="message" i18n> |
24 | The notification concerns a video now unavailable | 24 | The notification concerns a video now unavailable |
25 | </div> | 25 | </div> |
@@ -46,7 +46,7 @@ | |||
46 | <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon> | 46 | <my-global-icon iconName="flag" aria-hidden="true"></my-global-icon> |
47 | 47 | ||
48 | <div class="message" i18n> | 48 | <div class="message" i18n> |
49 | <a (click)="markAsRead(notification)" [routerLink]="notification.videoAbuseUrl">A new video abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.videoAbuse.video.name }}</a> | 49 | <a (click)="markAsRead(notification)" [routerLink]="notification.abuseUrl">A new video abuse</a> has been created on video <a (click)="markAsRead(notification)" [routerLink]="notification.videoUrl">{{ notification.abuse.video.name }}</a> |
50 | </div> | 50 | </div> |
51 | </ng-container> | 51 | </ng-container> |
52 | 52 | ||
@@ -65,7 +65,7 @@ | |||
65 | <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl"> | 65 | <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl"> |
66 | <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" /> | 66 | <img alt="" aria-labelledby="avatar" class="avatar" [src]="notification.comment.account.avatarUrl" /> |
67 | </a> | 67 | </a> |
68 | 68 | ||
69 | <div class="message" i18n> | 69 | <div class="message" i18n> |
70 | <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a> | 70 | <a (click)="markAsRead(notification)" [routerLink]="notification.accountUrl">{{ notification.comment.account.displayName }}</a> commented your video <a (click)="markAsRead(notification)" [routerLink]="notification.commentUrl">{{ notification.comment.video.name }}</a> |
71 | </div> | 71 | </div> |
@@ -73,7 +73,7 @@ | |||
73 | 73 | ||
74 | <ng-template #noComment> | 74 | <ng-template #noComment> |
75 | <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> | 75 | <my-global-icon iconName="alert" aria-hidden="true"></my-global-icon> |
76 | 76 | ||
77 | <div class="message" i18n> | 77 | <div class="message" i18n> |
78 | The notification concerns a comment now unavailable | 78 | The notification concerns a comment now unavailable |
79 | </div> | 79 | </div> |
diff --git a/client/src/app/shared/shared-moderation/video-abuse.service.ts b/client/src/app/shared/shared-moderation/abuse.service.ts index 44dea44a5..f45018d5c 100644 --- a/client/src/app/shared/shared-moderation/video-abuse.service.ts +++ b/client/src/app/shared/shared-moderation/abuse.service.ts | |||
@@ -5,12 +5,12 @@ import { catchError, map } from 'rxjs/operators' | |||
5 | import { HttpClient, HttpParams } from '@angular/common/http' | 5 | import { HttpClient, HttpParams } from '@angular/common/http' |
6 | import { Injectable } from '@angular/core' | 6 | import { Injectable } from '@angular/core' |
7 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 7 | import { RestExtractor, RestPagination, RestService } from '@app/core' |
8 | import { ResultList, VideoAbuse, VideoAbuseCreate, VideoAbuseState, VideoAbuseUpdate } from '@shared/models' | 8 | import { AbuseUpdate, ResultList, Abuse, AbuseCreate, AbuseState } from '@shared/models' |
9 | import { environment } from '../../../environments/environment' | 9 | import { environment } from '../../../environments/environment' |
10 | 10 | ||
11 | @Injectable() | 11 | @Injectable() |
12 | export class VideoAbuseService { | 12 | export class AbuseService { |
13 | private static BASE_VIDEO_ABUSE_URL = environment.apiUrl + '/api/v1/videos/' | 13 | private static BASE_ABUSE_URL = environment.apiUrl + '/api/v1/abuses' |
14 | 14 | ||
15 | constructor ( | 15 | constructor ( |
16 | private authHttp: HttpClient, | 16 | private authHttp: HttpClient, |
@@ -18,13 +18,13 @@ export class VideoAbuseService { | |||
18 | private restExtractor: RestExtractor | 18 | private restExtractor: RestExtractor |
19 | ) {} | 19 | ) {} |
20 | 20 | ||
21 | getVideoAbuses (options: { | 21 | getAbuses (options: { |
22 | pagination: RestPagination, | 22 | pagination: RestPagination, |
23 | sort: SortMeta, | 23 | sort: SortMeta, |
24 | search?: string | 24 | search?: string |
25 | }): Observable<ResultList<VideoAbuse>> { | 25 | }): Observable<ResultList<Abuse>> { |
26 | const { pagination, sort, search } = options | 26 | const { pagination, sort, search } = options |
27 | const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse' | 27 | const url = AbuseService.BASE_ABUSE_URL + 'abuse' |
28 | 28 | ||
29 | let params = new HttpParams() | 29 | let params = new HttpParams() |
30 | params = this.restService.addRestGetParams(params, pagination, sort) | 30 | params = this.restService.addRestGetParams(params, pagination, sort) |
@@ -35,9 +35,9 @@ export class VideoAbuseService { | |||
35 | state: { | 35 | state: { |
36 | prefix: 'state:', | 36 | prefix: 'state:', |
37 | handler: v => { | 37 | handler: v => { |
38 | if (v === 'accepted') return VideoAbuseState.ACCEPTED | 38 | if (v === 'accepted') return AbuseState.ACCEPTED |
39 | if (v === 'pending') return VideoAbuseState.PENDING | 39 | if (v === 'pending') return AbuseState.PENDING |
40 | if (v === 'rejected') return VideoAbuseState.REJECTED | 40 | if (v === 'rejected') return AbuseState.REJECTED |
41 | 41 | ||
42 | return undefined | 42 | return undefined |
43 | } | 43 | } |
@@ -59,14 +59,14 @@ export class VideoAbuseService { | |||
59 | params = this.restService.addObjectParams(params, filters) | 59 | params = this.restService.addObjectParams(params, filters) |
60 | } | 60 | } |
61 | 61 | ||
62 | return this.authHttp.get<ResultList<VideoAbuse>>(url, { params }) | 62 | return this.authHttp.get<ResultList<Abuse>>(url, { params }) |
63 | .pipe( | 63 | .pipe( |
64 | catchError(res => this.restExtractor.handleError(res)) | 64 | catchError(res => this.restExtractor.handleError(res)) |
65 | ) | 65 | ) |
66 | } | 66 | } |
67 | 67 | ||
68 | reportVideo (parameters: { id: number } & VideoAbuseCreate) { | 68 | reportVideo (parameters: AbuseCreate) { |
69 | const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + parameters.id + '/abuse' | 69 | const url = AbuseService.BASE_ABUSE_URL |
70 | 70 | ||
71 | const body = omit(parameters, [ 'id' ]) | 71 | const body = omit(parameters, [ 'id' ]) |
72 | 72 | ||
@@ -77,8 +77,8 @@ export class VideoAbuseService { | |||
77 | ) | 77 | ) |
78 | } | 78 | } |
79 | 79 | ||
80 | updateVideoAbuse (videoAbuse: VideoAbuse, abuseUpdate: VideoAbuseUpdate) { | 80 | updateAbuse (abuse: Abuse, abuseUpdate: AbuseUpdate) { |
81 | const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + videoAbuse.video.uuid + '/abuse/' + videoAbuse.id | 81 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
82 | 82 | ||
83 | return this.authHttp.put(url, abuseUpdate) | 83 | return this.authHttp.put(url, abuseUpdate) |
84 | .pipe( | 84 | .pipe( |
@@ -87,8 +87,8 @@ export class VideoAbuseService { | |||
87 | ) | 87 | ) |
88 | } | 88 | } |
89 | 89 | ||
90 | removeVideoAbuse (videoAbuse: VideoAbuse) { | 90 | removeAbuse (abuse: Abuse) { |
91 | const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + videoAbuse.video.uuid + '/abuse/' + videoAbuse.id | 91 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
92 | 92 | ||
93 | return this.authHttp.delete(url) | 93 | return this.authHttp.delete(url) |
94 | .pipe( | 94 | .pipe( |
diff --git a/client/src/app/shared/shared-moderation/index.ts b/client/src/app/shared/shared-moderation/index.ts index 8e74254f6..d6c4a10be 100644 --- a/client/src/app/shared/shared-moderation/index.ts +++ b/client/src/app/shared/shared-moderation/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './abuse.service' | ||
1 | export * from './account-block.model' | 2 | export * from './account-block.model' |
2 | export * from './account-blocklist.component' | 3 | export * from './account-blocklist.component' |
3 | export * from './batch-domains-modal.component' | 4 | export * from './batch-domains-modal.component' |
@@ -6,7 +7,6 @@ export * from './bulk.service' | |||
6 | export * from './server-blocklist.component' | 7 | export * from './server-blocklist.component' |
7 | export * from './user-ban-modal.component' | 8 | export * from './user-ban-modal.component' |
8 | export * from './user-moderation-dropdown.component' | 9 | export * from './user-moderation-dropdown.component' |
9 | export * from './video-abuse.service' | ||
10 | export * from './video-block.component' | 10 | export * from './video-block.component' |
11 | export * from './video-block.service' | 11 | export * from './video-block.service' |
12 | export * from './video-report.component' | 12 | export * from './video-report.component' |
diff --git a/client/src/app/shared/shared-moderation/shared-moderation.module.ts b/client/src/app/shared/shared-moderation/shared-moderation.module.ts index f7e64dfa3..742193e58 100644 --- a/client/src/app/shared/shared-moderation/shared-moderation.module.ts +++ b/client/src/app/shared/shared-moderation/shared-moderation.module.ts | |||
@@ -8,7 +8,7 @@ import { BlocklistService } from './blocklist.service' | |||
8 | import { BulkService } from './bulk.service' | 8 | import { BulkService } from './bulk.service' |
9 | import { UserBanModalComponent } from './user-ban-modal.component' | 9 | import { UserBanModalComponent } from './user-ban-modal.component' |
10 | import { UserModerationDropdownComponent } from './user-moderation-dropdown.component' | 10 | import { UserModerationDropdownComponent } from './user-moderation-dropdown.component' |
11 | import { VideoAbuseService } from './video-abuse.service' | 11 | import { AbuseService } from './abuse.service' |
12 | import { VideoBlockComponent } from './video-block.component' | 12 | import { VideoBlockComponent } from './video-block.component' |
13 | import { VideoBlockService } from './video-block.service' | 13 | import { VideoBlockService } from './video-block.service' |
14 | import { VideoReportComponent } from './video-report.component' | 14 | import { VideoReportComponent } from './video-report.component' |
@@ -39,7 +39,7 @@ import { VideoReportComponent } from './video-report.component' | |||
39 | providers: [ | 39 | providers: [ |
40 | BlocklistService, | 40 | BlocklistService, |
41 | BulkService, | 41 | BulkService, |
42 | VideoAbuseService, | 42 | AbuseService, |
43 | VideoBlockService | 43 | VideoBlockService |
44 | ] | 44 | ] |
45 | }) | 45 | }) |
diff --git a/client/src/app/shared/shared-moderation/video-report.component.ts b/client/src/app/shared/shared-moderation/video-report.component.ts index 11c805636..b8d9f8d27 100644 --- a/client/src/app/shared/shared-moderation/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/video-report.component.ts | |||
@@ -3,13 +3,13 @@ import { buildVideoEmbed, buildVideoLink } from 'src/assets/player/utils' | |||
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 { FormReactive, FormValidatorService, VideoAbuseValidatorsService } from '@app/shared/shared-forms' | 6 | import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
10 | import { videoAbusePredefinedReasonsMap, VideoAbusePredefinedReasonsString } from '@shared/models/videos/abuse/video-abuse-reason.model' | 10 | import { abusePredefinedReasonsMap, AbusePredefinedReasonsString } from '@shared/models' |
11 | import { Video } from '../shared-main' | 11 | import { Video } from '../shared-main' |
12 | import { VideoAbuseService } from './video-abuse.service' | 12 | import { AbuseService } from './abuse.service' |
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-video-report', | 15 | selector: 'my-video-report', |
@@ -22,7 +22,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
22 | @ViewChild('modal', { static: true }) modal: NgbModal | 22 | @ViewChild('modal', { static: true }) modal: NgbModal |
23 | 23 | ||
24 | error: string = null | 24 | error: string = null |
25 | predefinedReasons: { id: VideoAbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [] | 25 | predefinedReasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [] |
26 | embedHtml: SafeHtml | 26 | embedHtml: SafeHtml |
27 | 27 | ||
28 | private openedModal: NgbModalRef | 28 | private openedModal: NgbModalRef |
@@ -30,8 +30,8 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
30 | constructor ( | 30 | constructor ( |
31 | protected formValidatorService: FormValidatorService, | 31 | protected formValidatorService: FormValidatorService, |
32 | private modalService: NgbModal, | 32 | private modalService: NgbModal, |
33 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, | 33 | private abuseValidatorsService: AbuseValidatorsService, |
34 | private videoAbuseService: VideoAbuseService, | 34 | private abuseService: AbuseService, |
35 | private notifier: Notifier, | 35 | private notifier: Notifier, |
36 | private sanitizer: DomSanitizer, | 36 | private sanitizer: DomSanitizer, |
37 | private i18n: I18n | 37 | private i18n: I18n |
@@ -69,8 +69,8 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
69 | 69 | ||
70 | ngOnInit () { | 70 | ngOnInit () { |
71 | this.buildForm({ | 71 | this.buildForm({ |
72 | reason: this.videoAbuseValidatorsService.VIDEO_ABUSE_REASON, | 72 | reason: this.abuseValidatorsService.ABUSE_REASON, |
73 | predefinedReasons: mapValues(videoAbusePredefinedReasonsMap, r => null), | 73 | predefinedReasons: mapValues(abusePredefinedReasonsMap, r => null), |
74 | timestamp: { | 74 | timestamp: { |
75 | hasStart: null, | 75 | hasStart: null, |
76 | startAt: null, | 76 | startAt: null, |
@@ -136,15 +136,18 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
136 | 136 | ||
137 | report () { | 137 | report () { |
138 | const reason = this.form.get('reason').value | 138 | const reason = this.form.get('reason').value |
139 | const predefinedReasons = Object.keys(pickBy(this.form.get('predefinedReasons').value)) as VideoAbusePredefinedReasonsString[] | 139 | const predefinedReasons = Object.keys(pickBy(this.form.get('predefinedReasons').value)) as AbusePredefinedReasonsString[] |
140 | const { hasStart, startAt, hasEnd, endAt } = this.form.get('timestamp').value | 140 | const { hasStart, startAt, hasEnd, endAt } = this.form.get('timestamp').value |
141 | 141 | ||
142 | this.videoAbuseService.reportVideo({ | 142 | this.abuseService.reportVideo({ |
143 | id: this.video.id, | 143 | accountId: this.video.account.id, |
144 | reason, | 144 | reason, |
145 | predefinedReasons, | 145 | predefinedReasons, |
146 | startAt: hasStart && startAt ? startAt : undefined, | 146 | video: { |
147 | endAt: hasEnd && endAt ? endAt : undefined | 147 | id: this.video.id, |
148 | startAt: hasStart && startAt ? startAt : undefined, | ||
149 | endAt: hasEnd && endAt ? endAt : undefined | ||
150 | } | ||
148 | }).subscribe( | 151 | }).subscribe( |
149 | () => { | 152 | () => { |
150 | this.notifier.success(this.i18n('Video reported.')) | 153 | this.notifier.success(this.i18n('Video reported.')) |