]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-watch/comment/video-comment-add.component.ts
Handle when autoplay fails
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / comment / video-comment-add.component.ts
index 3e064efcbb67d738ce024bc312312d6485a2b737..731652fda4ba4a52a8f65430cae76d7874be5f18 100644 (file)
@@ -2,7 +2,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild }
 import { FormBuilder, FormGroup } from '@angular/forms'
 import { NotificationsService } from 'angular2-notifications'
 import { Observable } from 'rxjs/Observable'
-import { VideoCommentCreate, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
+import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model'
 import { FormReactive } from '../../../shared'
 import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment'
 import { User } from '../../../shared/users'
@@ -59,8 +59,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
 
     if (this.parentComment) {
       const mentions = this.parentComments
-        .filter(c => c.account.id !== this.user.account.id)
-        .map(c => '@' + c.account.name)
+        .filter(c => c.account.id !== this.user.account.id) // Don't add mention of ourselves
+        .map(c => '@' + c.by)
 
       const mentionsSet = new Set(mentions)
       const mentionsText = Array.from(mentionsSet).join(' ') + ' '
@@ -69,6 +69,13 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
     }
   }
 
+  onValidKey () {
+    this.onValueChanged()
+    if (!this.form.valid) return
+
+    this.formValidated()
+  }
+
   formValidated () {
     const commentCreate: VideoCommentCreate = this.form.value
     let obs: Observable<any>