]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/videos/+video-watch/comment/video-comment.component.ts
Send account activitypub update events
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / comment / video-comment.component.ts
CommitLineData
4635f59d 1import { Component, EventEmitter, Input, Output } from '@angular/core'
4635f59d
C
2import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
3import { AuthService } from '../../../core/auth'
4635f59d
C
4import { Video } from '../../../shared/video/video.model'
5import { VideoComment } from './video-comment.model'
4635f59d
C
6
7@Component({
8 selector: 'my-video-comment',
9 templateUrl: './video-comment.component.html',
10 styleUrls: ['./video-comment.component.scss']
11})
12export class VideoCommentComponent {
13 @Input() video: Video
14 @Input() comment: VideoComment
15 @Input() commentTree: VideoCommentThreadTree
16 @Input() inReplyToCommentId: number
17
18 @Output() wantedToReply = new EventEmitter<VideoComment>()
19 @Output() resetReply = new EventEmitter()
20
ae45f988 21 constructor (private authService: AuthService) {
4635f59d
C
22 }
23
ae45f988
C
24 onCommentReplyCreated (createdComment: VideoComment) {
25 if (!this.commentTree) {
26 this.commentTree = {
27 comment: this.comment,
28 children: []
29 }
30 }
31
32 this.commentTree.children.push({
33 comment: createdComment,
34 children: []
35 })
36 this.resetReply.emit()
4635f59d
C
37 }
38
39 onWantToReply () {
40 this.wantedToReply.emit(this.comment)
41 }
42
43 isUserLoggedIn () {
44 return this.authService.isLoggedIn()
45 }
46
47 // Event from child comment
48 onWantedToReply (comment: VideoComment) {
49 this.wantedToReply.emit(comment)
50 }
51
52 onResetReply () {
53 this.resetReply.emit()
54 }
55}