aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.html5
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comment.component.ts27
2 files changed, 30 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.html b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
index 002de57e4..f02ea549a 100644
--- a/client/src/app/+videos/+video-watch/comment/video-comment.component.html
+++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.html
@@ -45,6 +45,7 @@
45 <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div> 45 <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div>
46 46
47 <my-user-moderation-dropdown 47 <my-user-moderation-dropdown
48 [prependActions]="prependModerationActions"
48 buttonSize="small" [account]="commentAccount" [user]="commentUser" i18n-label label="Options" placement="bottom-left auto" 49 buttonSize="small" [account]="commentAccount" [user]="commentUser" i18n-label label="Options" placement="bottom-left auto"
49 ></my-user-moderation-dropdown> 50 ></my-user-moderation-dropdown>
50 </div> 51 </div>
@@ -93,3 +94,7 @@
93 </div> 94 </div>
94 </div> 95 </div>
95</div> 96</div>
97
98<ng-container *ngIf="prependModerationActions">
99 <my-comment-report #commentReportModal [comment]="comment"></my-comment-report>
100</ng-container>
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 @@
1import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' 1
2import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
2import { MarkdownService, Notifier, UserService } from '@app/core' 3import { MarkdownService, Notifier, UserService } from '@app/core'
3import { AuthService } from '@app/core/auth' 4import { AuthService } from '@app/core/auth'
4import { Account, Actor, Video } from '@app/shared/shared-main' 5import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main'
6import { CommentReportComponent } from '@app/shared/shared-moderation/comment-report.component'
7import { I18n } from '@ngx-translate/i18n-polyfill'
5import { User, UserRight } from '@shared/models' 8import { User, UserRight } from '@shared/models'
6import { VideoCommentThreadTree } from './video-comment-thread-tree.model' 9import { VideoCommentThreadTree } from './video-comment-thread-tree.model'
7import { VideoComment } from './video-comment.model' 10import { 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})
14export class VideoCommentComponent implements OnInit, OnChanges { 17export 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}