aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/menu/menu.component.html4
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.html14
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.scss21
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.ts6
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.html54
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.scss51
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.ts11
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.model.ts6
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.html1
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.scss1
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts1
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.html10
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.scss6
-rw-r--r--server/helpers/custom-validators/activitypub/actor.ts6
-rw-r--r--server/models/video/video-comment.ts10
-rw-r--r--server/tests/api/videos/video-comments.ts16
-rw-r--r--shared/models/videos/video-comment.model.ts7
17 files changed, 140 insertions, 85 deletions
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 5ea859fd2..d138d2ba7 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -1,6 +1,8 @@
1<menu> 1<menu>
2 <div *ngIf="isLoggedIn" class="logged-in-block"> 2 <div *ngIf="isLoggedIn" class="logged-in-block">
3 <img [src]="getUserAvatarUrl()" alt="Avatar" /> 3 <a routerLink="/account/settings">
4 <img [src]="getUserAvatarUrl()" alt="Avatar" />
5 </a>
4 6
5 <div class="logged-in-info"> 7 <div class="logged-in-info">
6 <a routerLink="/account/settings" class="logged-in-username">{{ user.username }}</a> 8 <a routerLink="/account/settings" class="logged-in-username">{{ user.username }}</a>
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
index 365fc8f6c..0eaa0d447 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html
@@ -1,9 +1,13 @@
1<form novalidate [formGroup]="form" (ngSubmit)="formValidated()"> 1<form novalidate [formGroup]="form" (ngSubmit)="formValidated()">
2 <div class="form-group"> 2 <div class="avatar-and-textarea">
3 <textarea placeholder="Add comment..." formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }" #textarea> 3 <img [src]="getUserAvatarUrl()" alt="Avatar" />
4 </textarea> 4
5 <div *ngIf="formErrors.text" class="form-error"> 5 <div class="form-group">
6 {{ formErrors.text }} 6 <textarea placeholder="Add comment..." formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }" #textarea>
7 </textarea>
8 <div *ngIf="formErrors.text" class="form-error">
9 {{ formErrors.text }}
10 </div>
7 </div> 11 </div>
8 </div> 12 </div>
9 13
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
index 9661062e8..37097da72 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
+++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.scss
@@ -1,12 +1,25 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4.form-group { 4.avatar-and-textarea {
5 display: flex;
5 margin-bottom: 10px; 6 margin-bottom: 10px;
6}
7 7
8textarea { 8 img {
9 @include peertube-textarea(100%, 150px); 9 @include avatar(36px);
10
11 vertical-align: top;
12 margin-right: 20px;
13 }
14
15 .form-group {
16 flex-grow: 1;
17 margin: 0;
18
19 textarea {
20 @include peertube-textarea(100%, 60px);
21 }
22 }
10} 23}
11 24
12.submit-comment { 25.submit-comment {
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 a6525987e..27655eca7 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
@@ -5,6 +5,7 @@ import { Observable } from 'rxjs/Observable'
5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 5import { VideoCommentCreate } 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 { Video } from '../../../shared/video/video.model' 9import { Video } from '../../../shared/video/video.model'
9import { VideoComment } from './video-comment.model' 10import { VideoComment } from './video-comment.model'
10import { VideoCommentService } from './video-comment.service' 11import { VideoCommentService } from './video-comment.service'
@@ -15,6 +16,7 @@ import { VideoCommentService } from './video-comment.service'
15 styleUrls: ['./video-comment-add.component.scss'] 16 styleUrls: ['./video-comment-add.component.scss']
16}) 17})
17export class VideoCommentAddComponent extends FormReactive implements OnInit { 18export class VideoCommentAddComponent extends FormReactive implements OnInit {
19 @Input() user: User
18 @Input() video: Video 20 @Input() video: Video
19 @Input() parentComment: VideoComment 21 @Input() parentComment: VideoComment
20 @Input() focusOnInit = false 22 @Input() focusOnInit = false
@@ -79,6 +81,10 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
79 return this.form.value['text'] 81 return this.form.value['text']
80 } 82 }
81 83
84 getUserAvatarUrl () {
85 return this.user.getAvatarUrl()
86 }
87
82 private addCommentReply (commentCreate: VideoCommentCreate) { 88 private addCommentReply (commentCreate: VideoCommentCreate) {
83 return this.videoCommentService 89 return this.videoCommentService
84 .addCommentReply(this.video.id, this.parentComment.id, commentCreate) 90 .addCommentReply(this.video.id, this.parentComment.id, commentCreate)
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 ffaf722cd..e9c23929c 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
@@ -1,29 +1,37 @@
1<div class="comment"> 1<div class="root-comment">
2 <div class="comment-account-date"> 2 <img [src]="getAvatarUrl(comment.account)" alt="Avatar" />
3 <div class="comment-account">{{ comment.by }}</div>
4 <div class="comment-date">{{ comment.createdAt | myFromNow }}</div>
5 </div>
6 <div>{{ comment.text }}</div>
7 3
8 <div class="comment-actions"> 4 <div class="comment">
9 <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div> 5 <div class="comment-account-date">
10 </div> 6 <div class="comment-account">{{ comment.by }}</div>
7 <div class="comment-date">{{ comment.createdAt | myFromNow }}</div>
8 </div>
9 <div>{{ comment.text }}</div>
10
11 <div class="comment-actions">
12 <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div>
13 </div>
11 14
12 <my-video-comment-add 15 <my-video-comment-add
13 *ngIf="isUserLoggedIn() && inReplyToCommentId === comment.id" [video]="video" [parentComment]="comment" [focusOnInit]="true" 16 *ngIf="isUserLoggedIn() && inReplyToCommentId === comment.id"
14 (commentCreated)="onCommentReplyCreated($event)" 17 [user]="user"
15 ></my-video-comment-add> 18 [video]="video"
19 [parentComment]="comment"
20 [focusOnInit]="true"
21 (commentCreated)="onCommentReplyCreated($event)"
22 ></my-video-comment-add>
16 23
17 <div *ngIf="commentTree" class="children"> 24 <div *ngIf="commentTree" class="children">
18 <div *ngFor="let commentChild of commentTree.children"> 25 <div *ngFor="let commentChild of commentTree.children">
19 <my-video-comment 26 <my-video-comment
20 [comment]="commentChild.comment" 27 [comment]="commentChild.comment"
21 [video]="video" 28 [video]="video"
22 [inReplyToCommentId]="inReplyToCommentId" 29 [inReplyToCommentId]="inReplyToCommentId"
23 [commentTree]="commentChild" 30 [commentTree]="commentChild"
24 (wantedToReply)="onWantedToReply($event)" 31 (wantedToReply)="onWantedToReply($event)"
25 (resetReply)="onResetReply()" 32 (resetReply)="onResetReply()"
26 ></my-video-comment> 33 ></my-video-comment>
34 </div>
27 </div> 35 </div>
28 </div> 36 </div>
29</div> 37</div>
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 7e1a32f48..aae03ab6d 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
@@ -1,38 +1,41 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4.comment { 4.root-comment {
5 font-size: 15px; 5 font-size: 15px;
6 margin-top: 30px; 6 display: flex;
7 7
8 .comment-account-date { 8 img {
9 display: flex; 9 @include avatar(36px);
10 margin-bottom: 4px;
11 10
12 .comment-account { 11 margin-top: 5px;
13 font-weight: $font-bold; 12 margin-right: 20px;
14 }
15
16 .comment-date {
17 color: #585858;
18 margin-left: 10px;
19 }
20 } 13 }
21 14
22 .comment-actions { 15 .comment {
23 margin: 10px 0; 16 flex-grow: 1;
17
18 .comment-account-date {
19 display: flex;
20 margin-bottom: 4px;
24 21
25 .comment-action-reply { 22 .comment-account {
26 color: #585858; 23 font-weight: $font-bold;
27 cursor: pointer; 24 }
25
26 .comment-date {
27 color: #585858;
28 margin-left: 10px;
29 }
28 } 30 }
29 }
30}
31 31
32.children { 32 .comment-actions {
33 margin-left: 20px; 33 margin: 10px 0;
34 34
35 .comment { 35 .comment-action-reply {
36 margin-top: 15px; 36 color: #585858;
37 cursor: pointer;
38 }
39 }
37 } 40 }
38} 41}
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 5af6e3335..b305c639a 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,6 +1,8 @@
1import { Component, EventEmitter, Input, Output } from '@angular/core' 1import { Component, EventEmitter, Input, Output } from '@angular/core'
2import { Account as AccountInterface } from '../../../../../../shared/models/actors'
2import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' 3import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
3import { AuthService } from '../../../core/auth' 4import { AuthService } from '../../../core/auth'
5import { Account } from '../../../shared/account/account.model'
4import { Video } from '../../../shared/video/video.model' 6import { Video } from '../../../shared/video/video.model'
5import { VideoComment } from './video-comment.model' 7import { VideoComment } from './video-comment.model'
6 8
@@ -18,7 +20,10 @@ export class VideoCommentComponent {
18 @Output() wantedToReply = new EventEmitter<VideoComment>() 20 @Output() wantedToReply = new EventEmitter<VideoComment>()
19 @Output() resetReply = new EventEmitter() 21 @Output() resetReply = new EventEmitter()
20 22
21 constructor (private authService: AuthService) { 23 constructor (private authService: AuthService) {}
24
25 get user () {
26 return this.authService.getUser()
22 } 27 }
23 28
24 onCommentReplyCreated (createdComment: VideoComment) { 29 onCommentReplyCreated (createdComment: VideoComment) {
@@ -52,4 +57,8 @@ export class VideoCommentComponent {
52 onResetReply () { 57 onResetReply () {
53 this.resetReply.emit() 58 this.resetReply.emit()
54 } 59 }
60
61 getAvatarUrl (account: AccountInterface) {
62 return Account.GET_ACCOUNT_AVATAR_URL(account)
63 }
55} 64}
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
index df7d5244c..abecae303 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.model.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
@@ -1,3 +1,4 @@
1import { Account } from '../../../../../../shared/models/actors'
1import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model' 2import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model'
2 3
3export class VideoComment implements VideoCommentServerModel { 4export class VideoComment implements VideoCommentServerModel {
@@ -9,10 +10,7 @@ export class VideoComment implements VideoCommentServerModel {
9 videoId: number 10 videoId: number
10 createdAt: Date | string 11 createdAt: Date | string
11 updatedAt: Date | string 12 updatedAt: Date | string
12 account: { 13 account: Account
13 name: string
14 host: string
15 }
16 totalReplies: number 14 totalReplies: number
17 15
18 by: string 16 by: string
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html
index 078900e06..4a4248073 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html
@@ -7,6 +7,7 @@
7 <my-video-comment-add 7 <my-video-comment-add
8 *ngIf="isUserLoggedIn()" 8 *ngIf="isUserLoggedIn()"
9 [video]="video" 9 [video]="video"
10 [user]="user"
10 (commentCreated)="onCommentThreadCreated($event)" 11 (commentCreated)="onCommentThreadCreated($event)"
11 ></my-video-comment-add> 12 ></my-video-comment-add>
12 13
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scss
index 2f6e4663b..be122eb2c 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss
@@ -5,6 +5,7 @@
5 font-weight: $font-semibold; 5 font-weight: $font-semibold;
6 font-size: 15px; 6 font-size: 15px;
7 cursor: pointer; 7 cursor: pointer;
8 margin-left: 56px;
8} 9}
9 10
10.glyphicon, .comment-thread-loading { 11.glyphicon, .comment-thread-loading {
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index 4d801c970..1230725c1 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -6,7 +6,6 @@ import { ComponentPagination } from '../../../shared/rest/component-pagination.m
6import { User } from '../../../shared/users' 6import { User } from '../../../shared/users'
7import { SortField } from '../../../shared/video/sort-field.type' 7import { SortField } from '../../../shared/video/sort-field.type'
8import { VideoDetails } from '../../../shared/video/video-details.model' 8import { VideoDetails } from '../../../shared/video/video-details.model'
9import { Video } from '../../../shared/video/video.model'
10import { VideoComment } from './video-comment.model' 9import { VideoComment } from './video-comment.model'
11import { VideoCommentService } from './video-comment.service' 10import { VideoCommentService } from './video-comment.service'
12 11
diff --git a/client/src/app/videos/+video-watch/video-watch.component.html b/client/src/app/videos/+video-watch/video-watch.component.html
index 48d1bb474..514a86e28 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.html
+++ b/client/src/app/videos/+video-watch/video-watch.component.html
@@ -14,14 +14,16 @@
14 14
15 <div class="video-info-actions"> 15 <div class="video-info-actions">
16 <div 16 <div
17 *ngIf="isUserLoggedIn()" [ngClass]="{ 'activated': userRating === 'like' }" (click)="setLike()" 17 *ngIf="isUserLoggedIn()" [ngClass]="{ 'activated': userRating === 'like' }" (click)="setLike()"
18 class="action-button action-button-like"> 18 class="action-button action-button-like"
19 >
19 <span class="icon icon-like" title="Like this video" ></span> 20 <span class="icon icon-like" title="Like this video" ></span>
20 </div> 21 </div>
21 22
22 <div 23 <div
23 *ngIf="isUserLoggedIn()" [ngClass]="{ 'activated': userRating === 'dislike' }" (click)="setDislike()" 24 *ngIf="isUserLoggedIn()" [ngClass]="{ 'activated': userRating === 'dislike' }" (click)="setDislike()"
24 class="action-button action-button-dislike"> 25 class="action-button action-button-dislike"
26 >
25 <span class="icon icon-dislike" title="Dislike this video"></span> 27 <span class="icon icon-dislike" title="Dislike this video"></span>
26 </div> 28 </div>
27 29
diff --git a/client/src/app/videos/+video-watch/video-watch.component.scss b/client/src/app/videos/+video-watch/video-watch.component.scss
index c101aa04e..7ebdfc0c4 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.scss
+++ b/client/src/app/videos/+video-watch/video-watch.component.scss
@@ -176,9 +176,9 @@
176 font-size: 13px; 176 font-size: 13px;
177 177
178 img { 178 img {
179 width: 16px; 179 @include avatar(18px);
180 height: 16px; 180
181 margin-left: 3px; 181 margin-left: 7px;
182 } 182 }
183 } 183 }
184 184
diff --git a/server/helpers/custom-validators/activitypub/actor.ts b/server/helpers/custom-validators/activitypub/actor.ts
index 8820bb2a4..e1a4b5b8f 100644
--- a/server/helpers/custom-validators/activitypub/actor.ts
+++ b/server/helpers/custom-validators/activitypub/actor.ts
@@ -1,8 +1,6 @@
1import * as validator from 'validator' 1import * as validator from 'validator'
2import { CONSTRAINTS_FIELDS } from '../../../initializers' 2import { CONSTRAINTS_FIELDS } from '../../../initializers'
3import { isAccountNameValid } from '../accounts'
4import { exists } from '../misc' 3import { exists } from '../misc'
5import { isVideoChannelNameValid } from '../video-channels'
6import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc' 4import { isActivityPubUrlValid, isBaseActivityValid, setValidAttributedTo } from './misc'
7 5
8function isActorEndpointsObjectValid (endpointObject: any) { 6function isActorEndpointsObjectValid (endpointObject: any) {
@@ -32,10 +30,6 @@ function isActorPreferredUsernameValid (preferredUsername: string) {
32 return exists(preferredUsername) && validator.matches(preferredUsername, actorNameRegExp) 30 return exists(preferredUsername) && validator.matches(preferredUsername, actorNameRegExp)
33} 31}
34 32
35function isActorNameValid (name: string) {
36 return isAccountNameValid(name) || isVideoChannelNameValid(name)
37}
38
39function isActorPrivateKeyValid (privateKey: string) { 33function isActorPrivateKeyValid (privateKey: string) {
40 return exists(privateKey) && 34 return exists(privateKey) &&
41 typeof privateKey === 'string' && 35 typeof privateKey === 'string' &&
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 63675c20b..d2d8945c3 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -9,6 +9,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp
9import { CONSTRAINTS_FIELDS } from '../../initializers' 9import { CONSTRAINTS_FIELDS } from '../../initializers'
10import { AccountModel } from '../account/account' 10import { AccountModel } from '../account/account'
11import { ActorModel } from '../activitypub/actor' 11import { ActorModel } from '../activitypub/actor'
12import { AvatarModel } from '../avatar/avatar'
12import { ServerModel } from '../server/server' 13import { ServerModel } from '../server/server'
13import { getSort, throwIfNotValid } from '../utils' 14import { getSort, throwIfNotValid } from '../utils'
14import { VideoModel } from './video' 15import { VideoModel } from './video'
@@ -46,6 +47,10 @@ enum ScopeNames {
46 { 47 {
47 model: () => ServerModel, 48 model: () => ServerModel,
48 required: false 49 required: false
50 },
51 {
52 model: () => AvatarModel,
53 required: false
49 } 54 }
50 ] 55 ]
51 } 56 }
@@ -243,10 +248,7 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
243 createdAt: this.createdAt, 248 createdAt: this.createdAt,
244 updatedAt: this.updatedAt, 249 updatedAt: this.updatedAt,
245 totalReplies: this.get('totalReplies') || 0, 250 totalReplies: this.get('totalReplies') || 0,
246 account: { 251 account: this.Account.toFormattedJSON()
247 name: this.Account.name,
248 host: this.Account.Actor.getHost()
249 }
250 } as VideoComment 252 } as VideoComment
251 } 253 }
252 254
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 3b6578f04..604a3027d 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -3,7 +3,11 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' 5import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
6import { dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils/index' 6import { testVideoImage } from '../../utils'
7import {
8 dateIsValid, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, updateMyAvatar,
9 uploadVideo
10} from '../../utils/index'
7import { 11import {
8 addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, 12 addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads,
9 getVideoThreadComments 13 getVideoThreadComments
@@ -29,6 +33,12 @@ describe('Test video comments', function () {
29 const res = await uploadVideo(server.url, server.accessToken, {}) 33 const res = await uploadVideo(server.url, server.accessToken, {})
30 videoUUID = res.body.video.uuid 34 videoUUID = res.body.video.uuid
31 videoId = res.body.video.id 35 videoId = res.body.video.id
36
37 await updateMyAvatar({
38 url: server.url,
39 accessToken: server.accessToken,
40 fixture: 'avatar.png'
41 })
32 }) 42 })
33 43
34 it('Should not have threads on this video', async function () { 44 it('Should not have threads on this video', async function () {
@@ -70,6 +80,10 @@ describe('Test video comments', function () {
70 expect(comment.id).to.equal(comment.threadId) 80 expect(comment.id).to.equal(comment.threadId)
71 expect(comment.account.name).to.equal('root') 81 expect(comment.account.name).to.equal('root')
72 expect(comment.account.host).to.equal('localhost:9001') 82 expect(comment.account.host).to.equal('localhost:9001')
83
84 const test = await testVideoImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
85 expect(test).to.equal(true)
86
73 expect(comment.totalReplies).to.equal(0) 87 expect(comment.totalReplies).to.equal(0)
74 expect(dateIsValid(comment.createdAt as string)).to.be.true 88 expect(dateIsValid(comment.createdAt as string)).to.be.true
75 expect(dateIsValid(comment.updatedAt as string)).to.be.true 89 expect(dateIsValid(comment.updatedAt as string)).to.be.true
diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/video-comment.model.ts
index d572927c2..7ac4024fb 100644
--- a/shared/models/videos/video-comment.model.ts
+++ b/shared/models/videos/video-comment.model.ts
@@ -1,3 +1,5 @@
1import { Account } from '../actors'
2
1export interface VideoComment { 3export interface VideoComment {
2 id: number 4 id: number
3 url: string 5 url: string
@@ -8,10 +10,7 @@ export interface VideoComment {
8 createdAt: Date | string 10 createdAt: Date | string
9 updatedAt: Date | string 11 updatedAt: Date | string
10 totalReplies: number 12 totalReplies: number
11 account: { 13 account: Account
12 name: string
13 host: string
14 }
15} 14}
16 15
17export interface VideoCommentThreadTree { 16export interface VideoCommentThreadTree {