diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index 27655eca7..3e064efcb 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } | |||
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { Observable } from 'rxjs/Observable' | 4 | import { Observable } from 'rxjs/Observable' |
5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentCreate, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
6 | import { FormReactive } from '../../../shared' | 6 | import { FormReactive } from '../../../shared' |
7 | import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' | 7 | import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' |
8 | import { User } from '../../../shared/users' | 8 | import { User } from '../../../shared/users' |
@@ -19,6 +19,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
19 | @Input() user: User | 19 | @Input() user: User |
20 | @Input() video: Video | 20 | @Input() video: Video |
21 | @Input() parentComment: VideoComment | 21 | @Input() parentComment: VideoComment |
22 | @Input() parentComments: VideoComment[] | ||
22 | @Input() focusOnInit = false | 23 | @Input() focusOnInit = false |
23 | 24 | ||
24 | @Output() commentCreated = new EventEmitter<VideoCommentCreate>() | 25 | @Output() commentCreated = new EventEmitter<VideoCommentCreate>() |
@@ -55,6 +56,17 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
55 | if (this.focusOnInit === true) { | 56 | if (this.focusOnInit === true) { |
56 | this.textareaElement.nativeElement.focus() | 57 | this.textareaElement.nativeElement.focus() |
57 | } | 58 | } |
59 | |||
60 | if (this.parentComment) { | ||
61 | const mentions = this.parentComments | ||
62 | .filter(c => c.account.id !== this.user.account.id) | ||
63 | .map(c => '@' + c.account.name) | ||
64 | |||
65 | const mentionsSet = new Set(mentions) | ||
66 | const mentionsText = Array.from(mentionsSet).join(' ') + ' ' | ||
67 | |||
68 | this.form.patchValue({ text: mentionsText }) | ||
69 | } | ||
58 | } | 70 | } |
59 | 71 | ||
60 | formValidated () { | 72 | formValidated () { |