aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-05 11:19:25 +0100
committerChocobozzz <me@florianbigard.com>2018-01-05 11:19:25 +0100
commitd7e70384a360cda51fe23712331110a5c8b1124c (patch)
tree385609669c92936a5c66ae028c331fb4a9b5943e /client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
parent2890b615f31ab7d519d8be66b49ff8712df90c51 (diff)
downloadPeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.tar.gz
PeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.tar.zst
PeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.zip
Add mentions to comments
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.ts14
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 }
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { Observable } from 'rxjs/Observable' 4import { Observable } from 'rxjs/Observable'
5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 5import { VideoCommentCreate, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
6import { FormReactive } from '../../../shared' 6import { FormReactive } from '../../../shared'
7import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' 7import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment'
8import { User } from '../../../shared/users' 8import { 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 () {