diff options
Diffstat (limited to 'client/src/app/+videos/+video-watch/comment/video-comment.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/comment/video-comment.component.ts | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts index 27846c1ad..2a4a6e737 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts | |||
@@ -1,7 +1,10 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 1 | |
2 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' | ||
2 | import { MarkdownService, Notifier, UserService } from '@app/core' | 3 | import { MarkdownService, Notifier, UserService } from '@app/core' |
3 | import { AuthService } from '@app/core/auth' | 4 | import { AuthService } from '@app/core/auth' |
4 | import { Account, Actor, Video } from '@app/shared/shared-main' | 5 | import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main' |
6 | import { CommentReportComponent } from '@app/shared/shared-moderation/comment-report.component' | ||
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { User, UserRight } from '@shared/models' | 8 | import { User, UserRight } from '@shared/models' |
6 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' | 9 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' |
7 | import { VideoComment } from './video-comment.model' | 10 | import { VideoComment } from './video-comment.model' |
@@ -12,6 +15,8 @@ import { VideoComment } from './video-comment.model' | |||
12 | styleUrls: ['./video-comment.component.scss'] | 15 | styleUrls: ['./video-comment.component.scss'] |
13 | }) | 16 | }) |
14 | export class VideoCommentComponent implements OnInit, OnChanges { | 17 | export class VideoCommentComponent implements OnInit, OnChanges { |
18 | @ViewChild('commentReportModal') commentReportModal: CommentReportComponent | ||
19 | |||
15 | @Input() video: Video | 20 | @Input() video: Video |
16 | @Input() comment: VideoComment | 21 | @Input() comment: VideoComment |
17 | @Input() parentComments: VideoComment[] = [] | 22 | @Input() parentComments: VideoComment[] = [] |
@@ -26,6 +31,8 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
26 | @Output() resetReply = new EventEmitter() | 31 | @Output() resetReply = new EventEmitter() |
27 | @Output() timestampClicked = new EventEmitter<number>() | 32 | @Output() timestampClicked = new EventEmitter<number>() |
28 | 33 | ||
34 | prependModerationActions: DropdownAction<any>[] | ||
35 | |||
29 | sanitizedCommentHTML = '' | 36 | sanitizedCommentHTML = '' |
30 | newParentComments: VideoComment[] = [] | 37 | newParentComments: VideoComment[] = [] |
31 | 38 | ||
@@ -33,6 +40,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
33 | commentUser: User | 40 | commentUser: User |
34 | 41 | ||
35 | constructor ( | 42 | constructor ( |
43 | private i18n: I18n, | ||
36 | private markdownService: MarkdownService, | 44 | private markdownService: MarkdownService, |
37 | private authService: AuthService, | 45 | private authService: AuthService, |
38 | private userService: UserService, | 46 | private userService: UserService, |
@@ -127,5 +135,20 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
127 | } else { | 135 | } else { |
128 | this.comment.account = null | 136 | this.comment.account = null |
129 | } | 137 | } |
138 | |||
139 | if (this.isUserLoggedIn()) { | ||
140 | this.prependModerationActions = [ | ||
141 | { | ||
142 | label: this.i18n('Report comment'), | ||
143 | handler: () => this.showReportModal() | ||
144 | } | ||
145 | ] | ||
146 | } else { | ||
147 | this.prependModerationActions = undefined | ||
148 | } | ||
149 | } | ||
150 | |||
151 | private showReportModal () { | ||
152 | this.commentReportModal.show() | ||
130 | } | 153 | } |
131 | } | 154 | } |