diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/comment')
6 files changed, 31 insertions, 47 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 e1a8f6260..79505c779 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 | |||
@@ -1,16 +1,13 @@ | |||
1 | import { Observable } from 'rxjs' | ||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
3 | import { Notifier } from '@app/core' | 4 | import { Notifier, User } from '@app/core' |
4 | import { Observable } from 'rxjs' | 5 | import { FormReactive, FormValidatorService, VideoCommentValidatorsService } from '@app/shared/shared-forms' |
5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 6 | import { Video } from '@app/shared/shared-main' |
6 | import { FormReactive } from '../../../shared' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
7 | import { User } from '../../../shared/users' | 8 | import { VideoCommentCreate } from '@shared/models' |
8 | import { Video } from '../../../shared/video/video.model' | ||
9 | import { VideoComment } from './video-comment.model' | 9 | import { VideoComment } from './video-comment.model' |
10 | import { VideoCommentService } from './video-comment.service' | 10 | import { VideoCommentService } from './video-comment.service' |
11 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
12 | import { VideoCommentValidatorsService } from '@app/shared/forms/form-validators/video-comment-validators.service' | ||
13 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | ||
14 | 11 | ||
15 | @Component({ | 12 | @Component({ |
16 | selector: 'my-video-comment-add', | 13 | selector: 'my-video-comment-add', |
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 index 1566d7369..7c2aaeadd 100644 --- 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 | |||
@@ -1,5 +1,5 @@ | |||
1 | import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' | 1 | import { VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '@shared/models' |
2 | import { VideoComment } from '@app/videos/+video-watch/comment/video-comment.model' | 2 | import { VideoComment } from './video-comment.model' |
3 | 3 | ||
4 | export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { | 4 | export class VideoCommentThreadTree implements VideoCommentThreadTreeServerModel { |
5 | comment: VideoComment | 5 | comment: VideoComment |
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 868addd58..27846c1ad 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,15 +1,10 @@ | |||
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 { MarkdownService, Notifier, UserService } from '@app/core' |
3 | import { AuthService } from '@app/core/auth' | 3 | import { AuthService } from '@app/core/auth' |
4 | import { AccountService } from '@app/shared/account/account.service' | 4 | import { Account, Actor, Video } from '@app/shared/shared-main' |
5 | import { Video } from '@app/shared/video/video.model' | 5 | import { User, UserRight } from '@shared/models' |
6 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' | ||
6 | import { VideoComment } from './video-comment.model' | 7 | import { VideoComment } from './video-comment.model' |
7 | import { MarkdownService } from '@app/shared/renderer' | ||
8 | import { Account } from '@app/shared/account/account.model' | ||
9 | import { Notifier } from '@app/core' | ||
10 | import { UserService } from '@app/shared' | ||
11 | import { Actor } from '@app/shared/actor/actor.model' | ||
12 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
13 | 8 | ||
14 | @Component({ | 9 | @Component({ |
15 | selector: 'my-video-comment', | 10 | selector: 'my-video-comment', |
@@ -40,7 +35,6 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
40 | constructor ( | 35 | constructor ( |
41 | private markdownService: MarkdownService, | 36 | private markdownService: MarkdownService, |
42 | private authService: AuthService, | 37 | private authService: AuthService, |
43 | private accountService: AccountService, | ||
44 | private userService: UserService, | 38 | private userService: UserService, |
45 | private notifier: Notifier | 39 | private notifier: Notifier |
46 | ) {} | 40 | ) {} |
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 171fc4acc..e85443196 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,7 +1,6 @@ | |||
1 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 1 | import { getAbsoluteAPIUrl } from '@app/helpers' |
2 | import { VideoComment as VideoCommentServerModel, VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 2 | import { Actor } from '@app/shared/shared-main' |
3 | import { Actor } from '@app/shared/actor/actor.model' | 3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models' |
4 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' | ||
5 | 4 | ||
6 | export class VideoComment implements VideoCommentServerModel { | 5 | export class VideoComment implements VideoCommentServerModel { |
7 | id: number | 6 | id: number |
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 0b0715390..a73fb9ca8 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 | |||
@@ -1,20 +1,19 @@ | |||
1 | import { Observable } from 'rxjs' | ||
1 | import { catchError, map } from 'rxjs/operators' | 2 | import { catchError, map } from 'rxjs/operators' |
2 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
4 | import { objectLineFeedToHtml } from '@app/shared/misc/utils' | 5 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' |
5 | import { Observable } from 'rxjs' | 6 | import { objectLineFeedToHtml } from '@app/helpers' |
6 | import { FeedFormat, ResultList } from '../../../../../../shared/models' | ||
7 | import { | 7 | import { |
8 | FeedFormat, | ||
9 | ResultList, | ||
8 | VideoComment as VideoCommentServerModel, | 10 | VideoComment as VideoCommentServerModel, |
9 | VideoCommentCreate, | 11 | VideoCommentCreate, |
10 | VideoCommentThreadTree as VideoCommentThreadTreeServerModel | 12 | VideoCommentThreadTree as VideoCommentThreadTreeServerModel |
11 | } from '../../../../../../shared/models/videos/video-comment.model' | 13 | } from '@shared/models' |
12 | import { environment } from '../../../../environments/environment' | 14 | import { environment } from '../../../../environments/environment' |
13 | import { RestExtractor, RestService } from '../../../shared/rest' | 15 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' |
14 | import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' | ||
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' | ||
18 | 17 | ||
19 | @Injectable() | 18 | @Injectable() |
20 | export class VideoCommentService { | 19 | export class VideoCommentService { |
@@ -52,7 +51,7 @@ export class VideoCommentService { | |||
52 | getVideoCommentThreads (parameters: { | 51 | getVideoCommentThreads (parameters: { |
53 | videoId: number | string, | 52 | videoId: number | string, |
54 | componentPagination: ComponentPaginationLight, | 53 | componentPagination: ComponentPaginationLight, |
55 | sort: CommentSortField | 54 | sort: string |
56 | }): Observable<ResultList<VideoComment>> { | 55 | }): Observable<ResultList<VideoComment>> { |
57 | const { videoId, componentPagination, sort } = parameters | 56 | const { videoId, componentPagination, sort } = parameters |
58 | 57 | ||
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 bba9f1372..df0018ec6 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,18 +1,13 @@ | |||
1 | import { Subject, Subscription } from 'rxjs' | ||
1 | import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 3 | import { ActivatedRoute } from '@angular/router' |
3 | import { ConfirmService, Notifier } from '@app/core' | 4 | import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifier, User } from '@app/core' |
4 | import { Subject, Subscription } from 'rxjs' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
5 | import { AuthService } from '../../../core/auth' | 6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' |
6 | import { ComponentPagination, hasMoreItems } from '../../../shared/rest/component-pagination.model' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { User } from '../../../shared/users' | 8 | import { VideoCommentThreadTree } from './video-comment-thread-tree.model' |
8 | import { CommentSortField } from '../../../shared/video/sort-field.type' | ||
9 | import { VideoDetails } from '../../../shared/video/video-details.model' | ||
10 | import { VideoComment } from './video-comment.model' | 9 | import { VideoComment } from './video-comment.model' |
11 | import { VideoCommentService } from './video-comment.service' | 10 | import { VideoCommentService } from './video-comment.service' |
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
13 | import { Syndication } from '@app/shared/video/syndication.model' | ||
14 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
15 | import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' | ||
16 | 11 | ||
17 | @Component({ | 12 | @Component({ |
18 | selector: 'my-video-comments', | 13 | selector: 'my-video-comments', |
@@ -28,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
28 | 23 | ||
29 | comments: VideoComment[] = [] | 24 | comments: VideoComment[] = [] |
30 | highlightedThread: VideoComment | 25 | highlightedThread: VideoComment |
31 | sort: CommentSortField = '-createdAt' | 26 | sort = '-createdAt' |
32 | componentPagination: ComponentPagination = { | 27 | componentPagination: ComponentPagination = { |
33 | currentPage: 1, | 28 | currentPage: 1, |
34 | itemsPerPage: 10, | 29 | itemsPerPage: 10, |
@@ -154,7 +149,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
154 | this.viewReplies(commentTree.comment.id) | 149 | this.viewReplies(commentTree.comment.id) |
155 | } | 150 | } |
156 | 151 | ||
157 | handleSortChange (sort: CommentSortField) { | 152 | handleSortChange (sort: string) { |
158 | if (this.sort === sort) return | 153 | if (this.sort === sort) return |
159 | 154 | ||
160 | this.sort = sort | 155 | this.sort = sort |