diff options
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 2d991aae9..b135792a7 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |||
@@ -10,6 +10,10 @@ import { ConfirmService } from '../../../core/index' | |||
10 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' | 10 | import { ModerationCommentModalComponent } from './moderation-comment-modal.component' |
11 | import { Video } from '../../../shared/video/video.model' | 11 | import { Video } from '../../../shared/video/video.model' |
12 | import { MarkdownService } from '@app/shared/renderer' | 12 | import { MarkdownService } from '@app/shared/renderer' |
13 | import { Actor } from '@app/shared/actor/actor.model' | ||
14 | import { buildVideoLink, buildVideoEmbed } from 'src/assets/player/utils' | ||
15 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
16 | import { DomSanitizer } from '@angular/platform-browser' | ||
13 | 17 | ||
14 | @Component({ | 18 | @Component({ |
15 | selector: 'my-video-abuse-list', | 19 | selector: 'my-video-abuse-list', |
@@ -32,7 +36,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
32 | private videoAbuseService: VideoAbuseService, | 36 | private videoAbuseService: VideoAbuseService, |
33 | private confirmService: ConfirmService, | 37 | private confirmService: ConfirmService, |
34 | private i18n: I18n, | 38 | private i18n: I18n, |
35 | private markdownRenderer: MarkdownService | 39 | private markdownRenderer: MarkdownService, |
40 | private sanitizer: DomSanitizer | ||
36 | ) { | 41 | ) { |
37 | super() | 42 | super() |
38 | 43 | ||
@@ -42,8 +47,14 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
42 | handler: videoAbuse => this.removeVideoAbuse(videoAbuse) | 47 | handler: videoAbuse => this.removeVideoAbuse(videoAbuse) |
43 | }, | 48 | }, |
44 | { | 49 | { |
45 | label: this.i18n('Update moderation comment'), | 50 | label: this.i18n('Add note'), |
46 | handler: videoAbuse => this.openModerationCommentModal(videoAbuse) | 51 | handler: videoAbuse => this.openModerationCommentModal(videoAbuse), |
52 | isDisplayed: videoAbuse => !videoAbuse.moderationComment | ||
53 | }, | ||
54 | { | ||
55 | label: this.i18n('Update note'), | ||
56 | handler: videoAbuse => this.openModerationCommentModal(videoAbuse), | ||
57 | isDisplayed: videoAbuse => !!videoAbuse.moderationComment | ||
47 | }, | 58 | }, |
48 | { | 59 | { |
49 | label: this.i18n('Mark as accepted'), | 60 | label: this.i18n('Mark as accepted'), |
@@ -90,6 +101,19 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
90 | return Video.buildClientUrl(videoAbuse.video.uuid) | 101 | return Video.buildClientUrl(videoAbuse.video.uuid) |
91 | } | 102 | } |
92 | 103 | ||
104 | getVideoEmbed (videoAbuse: VideoAbuse) { | ||
105 | const absoluteAPIUrl = 'http://localhost:9000' || getAbsoluteAPIUrl() | ||
106 | const embedUrl = buildVideoLink({ | ||
107 | baseUrl: absoluteAPIUrl + '/videos/embed/' + videoAbuse.video.uuid, | ||
108 | warningTitle: false | ||
109 | }) | ||
110 | return buildVideoEmbed(embedUrl) | ||
111 | } | ||
112 | |||
113 | switchToDefaultAvatar ($event: Event) { | ||
114 | ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() | ||
115 | } | ||
116 | |||
93 | async removeVideoAbuse (videoAbuse: VideoAbuse) { | 117 | async removeVideoAbuse (videoAbuse: VideoAbuse) { |
94 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse report?'), this.i18n('Delete')) | 118 | const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse report?'), this.i18n('Delete')) |
95 | if (res === false) return | 119 | if (res === false) return |
@@ -125,7 +149,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
125 | for (const abuse of this.videoAbuses) { | 149 | for (const abuse of this.videoAbuses) { |
126 | Object.assign(abuse, { | 150 | Object.assign(abuse, { |
127 | reasonHtml: await this.toHtml(abuse.reason), | 151 | reasonHtml: await this.toHtml(abuse.reason), |
128 | moderationCommentHtml: await this.toHtml(abuse.moderationComment) | 152 | moderationCommentHtml: await this.toHtml(abuse.moderationComment), |
153 | embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)) | ||
129 | }) | 154 | }) |
130 | } | 155 | } |
131 | 156 | ||