diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 41 insertions, 4 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 e26100346..d5aacf107 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 | |||
@@ -36,6 +36,9 @@ | |||
36 | <div class="comment-actions"> | 36 | <div class="comment-actions"> |
37 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div> | 37 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div> |
38 | <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div> | 38 | <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div> |
39 | <my-user-moderation-dropdown | ||
40 | buttonSize="small" [account]="commentAccount" [user]="commentUser" label="Options" placement="bottom-left auto" | ||
41 | ></my-user-moderation-dropdown> | ||
39 | </div> | 42 | </div> |
40 | </ng-container> | 43 | </ng-container> |
41 | 44 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.scss b/client/src/app/videos/+video-watch/comment/video-comment.component.scss index c70914f9b..cebb24c12 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.scss | |||
@@ -114,6 +114,7 @@ | |||
114 | margin-bottom: 10px; | 114 | margin-bottom: 10px; |
115 | display: flex; | 115 | display: flex; |
116 | 116 | ||
117 | ::ng-deep .dropdown-toggle, | ||
117 | .comment-action-reply, | 118 | .comment-action-reply, |
118 | .comment-action-delete { | 119 | .comment-action-delete { |
119 | color: $grey-foreground-color; | 120 | color: $grey-foreground-color; |
@@ -124,6 +125,12 @@ | |||
124 | color: var(--mainForegroundColor); | 125 | color: var(--mainForegroundColor); |
125 | } | 126 | } |
126 | } | 127 | } |
128 | |||
129 | ::ng-deep .action-button { | ||
130 | background-color: transparent; | ||
131 | padding: 0; | ||
132 | font-weight: unset; | ||
133 | } | ||
127 | } | 134 | } |
128 | } | 135 | } |
129 | 136 | ||
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 b2bf3ee1b..0d48f0a82 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,10 +1,14 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
2 | import { UserRight } from '../../../../../../shared/models/users' | 2 | import { User, UserRight } from '../../../../../../shared/models/users' |
3 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 3 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
4 | import { AuthService } from '../../../core/auth' | 4 | import { AuthService } from '@app/core/auth' |
5 | import { Video } from '../../../shared/video/video.model' | 5 | import { AccountService } from '@app/shared/account/account.service' |
6 | import { Video } from '@app/shared/video/video.model' | ||
6 | import { VideoComment } from './video-comment.model' | 7 | import { VideoComment } from './video-comment.model' |
7 | import { MarkdownService } from '@app/shared/renderer' | 8 | import { MarkdownService } from '@app/shared/renderer' |
9 | import { Account } from '@app/shared/account/account.model' | ||
10 | import { Notifier } from '@app/core' | ||
11 | import { UserService } from '@app/shared' | ||
8 | 12 | ||
9 | @Component({ | 13 | @Component({ |
10 | selector: 'my-video-comment', | 14 | selector: 'my-video-comment', |
@@ -28,9 +32,15 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
28 | sanitizedCommentHTML = '' | 32 | sanitizedCommentHTML = '' |
29 | newParentComments: VideoComment[] = [] | 33 | newParentComments: VideoComment[] = [] |
30 | 34 | ||
35 | commentAccount: Account | ||
36 | commentUser: User | ||
37 | |||
31 | constructor ( | 38 | constructor ( |
32 | private markdownService: MarkdownService, | 39 | private markdownService: MarkdownService, |
33 | private authService: AuthService | 40 | private authService: AuthService, |
41 | private accountService: AccountService, | ||
42 | private userService: UserService, | ||
43 | private notifier: Notifier | ||
34 | ) {} | 44 | ) {} |
35 | 45 | ||
36 | get user () { | 46 | get user () { |
@@ -90,9 +100,26 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
90 | ) | 100 | ) |
91 | } | 101 | } |
92 | 102 | ||
103 | private getUserIfNeeded (account: Account) { | ||
104 | if (!account.userId) return | ||
105 | if (!this.authService.isLoggedIn()) return | ||
106 | |||
107 | const user = this.authService.getUser() | ||
108 | if (user.hasRight(UserRight.MANAGE_USERS)) { | ||
109 | this.userService.getUser(account.userId) | ||
110 | .subscribe( | ||
111 | user => this.commentUser = user, | ||
112 | |||
113 | err => this.notifier.error(err.message) | ||
114 | ) | ||
115 | } | ||
116 | } | ||
117 | |||
93 | private async init () { | 118 | private async init () { |
94 | const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true) | 119 | const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true) |
95 | this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html) | 120 | this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html) |
96 | this.newParentComments = this.parentComments.concat([ this.comment ]) | 121 | this.newParentComments = this.parentComments.concat([ this.comment ]) |
122 | this.commentAccount = new Account(this.comment.account) | ||
123 | this.getUserIfNeeded(this.commentAccount) | ||
97 | } | 124 | } |
98 | } | 125 | } |