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 | 36 |
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 | } |