aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/comment/video-comment.component.ts
diff options
context:
space:
mode:
authorkimsible <kimsible@users.noreply.github.com>2020-08-07 17:49:56 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-14 15:03:38 +0200
commit45ae994a442dd21ed630bef95d56559f8cc6029c (patch)
tree1cccbfa1696a4e8aa2f083906f51d1a4f595070d /client/src/app/+videos/+video-watch/comment/video-comment.component.ts
parentf63c03fb6ecccb5ac8e0d88917f072339b38ffb5 (diff)
downloadPeerTube-45ae994a442dd21ed630bef95d56559f8cc6029c.tar.gz
PeerTube-45ae994a442dd21ed630bef95d56559f8cc6029c.tar.zst
PeerTube-45ae994a442dd21ed630bef95d56559f8cc6029c.zip
Move delete, delete & redraft actions to 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.ts36
1 files changed, 28 insertions, 8 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 507132909..c2964d370 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
@@ -115,6 +115,10 @@ export class VideoCommentComponent implements OnInit, OnChanges {
115 return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0 115 return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0
116 } 116 }
117 117
118 isReportableByUser() {
119 return this.comment.account && this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id
120 }
121
118 switchToDefaultAvatar ($event: Event) { 122 switchToDefaultAvatar ($event: Event) {
119 ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL() 123 ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
120 } 124 }
@@ -146,14 +150,30 @@ export class VideoCommentComponent implements OnInit, OnChanges {
146 this.comment.account = null 150 this.comment.account = null
147 } 151 }
148 152
149 if (this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id) { 153 this.prependModerationActions = []
150 this.prependModerationActions = [ 154
151 { 155 if (this.isReportableByUser()) {
152 label: $localize`Report comment`, 156 this.prependModerationActions.push({
153 handler: () => this.showReportModal() 157 label: $localize`Report comment`,
154 } 158 handler: () => this.showReportModal()
155 ] 159 })
156 } else { 160 }
161
162 if (this.isRemovableByUser()) {
163 this.prependModerationActions.push({
164 label: $localize`Remove comment`,
165 handler: () => this.onWantToDelete()
166 })
167 }
168
169 if (this.isRedraftableByUser()) {
170 this.prependModerationActions.push({
171 label: $localize`Remove & re-draft comment`,
172 handler: () => this.onWantToRedraft()
173 })
174 }
175
176 if (this.prependModerationActions.length === 0) {
157 this.prependModerationActions = undefined 177 this.prependModerationActions = undefined
158 } 178 }
159 } 179 }