diff options
author | Chocobozzz <me@florianbigard.com> | 2020-02-10 14:25:38 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-02-10 16:39:28 +0100 |
commit | be27ef3b4682c5639039474c39ee0d234d16f482 (patch) | |
tree | e3ee4a58ed9d99598150b87d6715e1c458ce7c92 /client/src/app/videos | |
parent | 361dcebc75dea74947b6c3aafd9d7d720c054b01 (diff) | |
download | PeerTube-be27ef3b4682c5639039474c39ee0d234d16f482.tar.gz PeerTube-be27ef3b4682c5639039474c39ee0d234d16f482.tar.zst PeerTube-be27ef3b4682c5639039474c39ee0d234d16f482.zip |
Strict templates enabled
Diffstat (limited to 'client/src/app/videos')
8 files changed, 23 insertions, 15 deletions
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html index e40649d95..6d72e5765 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html | |||
@@ -29,7 +29,7 @@ | |||
29 | <tag-input | 29 | <tag-input |
30 | [validators]="tagValidators" [errorMessages]="tagValidatorsMessages" | 30 | [validators]="tagValidators" [errorMessages]="tagValidatorsMessages" |
31 | i18n-placeholder placeholder="+ Tag" i18n-secondaryPlaceholder secondaryPlaceholder="Enter a new tag" | 31 | i18n-placeholder placeholder="+ Tag" i18n-secondaryPlaceholder secondaryPlaceholder="Enter a new tag" |
32 | formControlName="tags" maxItems="5" modelAsStrings="true" | 32 | formControlName="tags" [maxItems]="5" [modelAsStrings]="true" |
33 | ></tag-input> | 33 | ></tag-input> |
34 | </div> | 34 | </div> |
35 | 35 | ||
@@ -44,7 +44,7 @@ | |||
44 | </ng-template> | 44 | </ng-template> |
45 | </my-help> | 45 | </my-help> |
46 | 46 | ||
47 | <my-markdown-textarea truncate="250" formControlName="description" markdownVideo="true"></my-markdown-textarea> | 47 | <my-markdown-textarea [truncate]="250" formControlName="description" [markdownVideo]="true"></my-markdown-textarea> |
48 | 48 | ||
49 | <div *ngIf="formErrors.description" class="form-error"> | 49 | <div *ngIf="formErrors.description" class="form-error"> |
50 | {{ formErrors.description }} | 50 | {{ formErrors.description }} |
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 1be96ad9e..a8c432653 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 | |||
@@ -25,7 +25,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
25 | @Input() parentComments: VideoComment[] | 25 | @Input() parentComments: VideoComment[] |
26 | @Input() focusOnInit = false | 26 | @Input() focusOnInit = false |
27 | 27 | ||
28 | @Output() commentCreated = new EventEmitter<VideoCommentCreate>() | 28 | @Output() commentCreated = new EventEmitter<VideoComment>() |
29 | @Output() cancel = new EventEmitter() | 29 | @Output() cancel = new EventEmitter() |
30 | 30 | ||
31 | @ViewChild('visitorModal', { static: true }) visitorModal: NgbModal | 31 | @ViewChild('visitorModal', { static: true }) visitorModal: NgbModal |
@@ -96,7 +96,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
96 | this.addingComment = true | 96 | this.addingComment = true |
97 | 97 | ||
98 | const commentCreate: VideoCommentCreate = this.form.value | 98 | const commentCreate: VideoCommentCreate = this.form.value |
99 | let obs: Observable<any> | 99 | let obs: Observable<VideoComment> |
100 | 100 | ||
101 | if (this.parentComment) { | 101 | if (this.parentComment) { |
102 | obs = this.addCommentReply(commentCreate) | 102 | obs = this.addCommentReply(commentCreate) |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts new file mode 100644 index 000000000..1566d7369 --- /dev/null +++ b/client/src/app/videos/+video-watch/comment/video-comment-thread-tree.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' | ||
2 | import { VideoComment } from '@app/videos/+video-watch/comment/video-comment.model' | ||
3 | |||
4 | export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { | ||
5 | comment: VideoComment | ||
6 | children: VideoCommentThreadTree[] | ||
7 | } | ||
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 61f9335d1..f7eca45fd 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,5 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
2 | import { User, UserRight } from '../../../../../../shared/models/users' | 2 | import { User, UserRight } from '../../../../../../shared/models/users' |
3 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | ||
4 | import { AuthService } from '@app/core/auth' | 3 | import { AuthService } from '@app/core/auth' |
5 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { AccountService } from '@app/shared/account/account.service' |
6 | import { Video } from '@app/shared/video/video.model' | 5 | import { Video } from '@app/shared/video/video.model' |
@@ -10,6 +9,7 @@ import { Account } from '@app/shared/account/account.model' | |||
10 | import { Notifier } from '@app/core' | 9 | import { Notifier } from '@app/core' |
11 | import { UserService } from '@app/shared' | 10 | import { UserService } from '@app/shared' |
12 | import { Actor } from '@app/shared/actor/actor.model' | 11 | import { Actor } from '@app/shared/actor/actor.model' |
12 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-video-comment', | 15 | selector: 'my-video-comment', |
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 aaeb0ea9c..171fc4acc 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,5 +1,5 @@ | |||
1 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 1 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
2 | import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model' | 2 | import { VideoComment as VideoCommentServerModel, VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' |
3 | import { Actor } from '@app/shared/actor/actor.model' | 3 | import { Actor } from '@app/shared/actor/actor.model' |
4 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | 4 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' |
5 | 5 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index a81e5236a..0b0715390 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -7,13 +7,14 @@ import { FeedFormat, ResultList } from '../../../../../../shared/models' | |||
7 | import { | 7 | import { |
8 | VideoComment as VideoCommentServerModel, | 8 | VideoComment as VideoCommentServerModel, |
9 | VideoCommentCreate, | 9 | VideoCommentCreate, |
10 | VideoCommentThreadTree | 10 | VideoCommentThreadTree as VideoCommentThreadTreeServerModel |
11 | } from '../../../../../../shared/models/videos/video-comment.model' | 11 | } from '../../../../../../shared/models/videos/video-comment.model' |
12 | import { environment } from '../../../../environments/environment' | 12 | import { environment } from '../../../../environments/environment' |
13 | import { RestExtractor, RestService } from '../../../shared/rest' | 13 | import { RestExtractor, RestService } from '../../../shared/rest' |
14 | import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' | 14 | import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' |
15 | import { CommentSortField } from '../../../shared/video/sort-field.type' | 15 | import { CommentSortField } from '../../../shared/video/sort-field.type' |
16 | import { VideoComment } from './video-comment.model' | 16 | import { VideoComment } from './video-comment.model' |
17 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
17 | 18 | ||
18 | @Injectable() | 19 | @Injectable() |
19 | export class VideoCommentService { | 20 | export class VideoCommentService { |
@@ -76,9 +77,9 @@ export class VideoCommentService { | |||
76 | const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` | 77 | const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` |
77 | 78 | ||
78 | return this.authHttp | 79 | return this.authHttp |
79 | .get(url) | 80 | .get<VideoCommentThreadTreeServerModel>(url) |
80 | .pipe( | 81 | .pipe( |
81 | map(tree => this.extractVideoCommentTree(tree as VideoCommentThreadTree)), | 82 | map(tree => this.extractVideoCommentTree(tree)), |
82 | catchError(err => this.restExtractor.handleError(err)) | 83 | catchError(err => this.restExtractor.handleError(err)) |
83 | ) | 84 | ) |
84 | } | 85 | } |
@@ -138,12 +139,12 @@ export class VideoCommentService { | |||
138 | return { data: comments, total: totalComments } | 139 | return { data: comments, total: totalComments } |
139 | } | 140 | } |
140 | 141 | ||
141 | private extractVideoCommentTree (tree: VideoCommentThreadTree) { | 142 | private extractVideoCommentTree (tree: VideoCommentThreadTreeServerModel) { |
142 | if (!tree) return tree | 143 | if (!tree) return tree as VideoCommentThreadTree |
143 | 144 | ||
144 | tree.comment = new VideoComment(tree.comment) | 145 | tree.comment = new VideoComment(tree.comment) |
145 | tree.children.forEach(c => this.extractVideoCommentTree(c)) | 146 | tree.children.forEach(c => this.extractVideoCommentTree(c)) |
146 | 147 | ||
147 | return tree | 148 | return tree as VideoCommentThreadTree |
148 | } | 149 | } |
149 | } | 150 | } |
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 47720b0ea..750c09c47 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 | |||
@@ -1,8 +1,7 @@ | |||
1 | import { Component, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild, Output, EventEmitter } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { ConfirmService, Notifier } from '@app/core' | 3 | import { ConfirmService, Notifier } from '@app/core' |
4 | import { Subject, Subscription } from 'rxjs' | 4 | import { Subject, Subscription } from 'rxjs' |
5 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | ||
6 | import { AuthService } from '../../../core/auth' | 5 | import { AuthService } from '../../../core/auth' |
7 | import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' | 6 | import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' |
8 | import { User } from '../../../shared/users' | 7 | import { User } from '../../../shared/users' |
@@ -13,6 +12,7 @@ import { VideoCommentService } from './video-comment.service' | |||
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 12 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Syndication } from '@app/shared/video/syndication.model' | 13 | import { Syndication } from '@app/shared/video/syndication.model' |
15 | import { HooksService } from '@app/core/plugins/hooks.service' | 14 | import { HooksService } from '@app/core/plugins/hooks.service' |
15 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'my-video-comments', | 18 | selector: 'my-video-comments', |
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.html b/client/src/app/videos/+video-watch/modal/video-share.component.html index 549a9f30e..593dd8529 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.html +++ b/client/src/app/videos/+video-watch/modal/video-share.component.html | |||
@@ -42,7 +42,7 @@ | |||
42 | <ngb-tab i18n-title title="QR-Code" id="qrcode"> | 42 | <ngb-tab i18n-title title="QR-Code" id="qrcode"> |
43 | <ng-template ngbTabContent> | 43 | <ng-template ngbTabContent> |
44 | <div class="tab-content"> | 44 | <div class="tab-content"> |
45 | <qrcode [qrdata]="getVideoUrl()" size="256" level="Q"></qrcode> | 45 | <qrcode [qrdata]="getVideoUrl()" [size]="256" level="Q"></qrcode> |
46 | </div> | 46 | </div> |
47 | </ng-template> | 47 | </ng-template> |
48 | </ngb-tab> | 48 | </ngb-tab> |