aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/plugins/plugin.service.ts7
-rw-r--r--client/src/app/search/search.component.ts10
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts9
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts4
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts2
5 files changed, 20 insertions, 12 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index 14310f093..7c1d69bec 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -28,6 +28,7 @@ export class PluginService implements ClientHook {
28 28
29 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = { 29 pluginsLoaded: { [ scope in PluginClientScope ]: ReplaySubject<boolean> } = {
30 common: new ReplaySubject<boolean>(1), 30 common: new ReplaySubject<boolean>(1),
31 search: new ReplaySubject<boolean>(1),
31 'video-watch': new ReplaySubject<boolean>(1) 32 'video-watch': new ReplaySubject<boolean>(1)
32 } 33 }
33 34
@@ -109,7 +110,11 @@ export class PluginService implements ClientHook {
109 if (!isReload) this.loadedScopes.push(scope) 110 if (!isReload) this.loadedScopes.push(scope)
110 111
111 const toLoad = this.scopes[ scope ] 112 const toLoad = this.scopes[ scope ]
112 if (!Array.isArray(toLoad)) return 113 if (!Array.isArray(toLoad)) {
114 this.pluginsLoaded[scope].next(true)
115
116 return
117 }
113 118
114 const promises: Promise<any>[] = [] 119 const promises: Promise<any>[] = []
115 for (const pluginInfo of toLoad) { 120 for (const pluginInfo of toLoad) {
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index b1d732d68..55637771e 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -11,6 +11,7 @@ import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
11import { immutableAssign } from '@app/shared/misc/utils' 11import { immutableAssign } from '@app/shared/misc/utils'
12import { Video } from '@app/shared/video/video.model' 12import { Video } from '@app/shared/video/video.model'
13import { HooksService } from '@app/core/plugins/hooks.service' 13import { HooksService } from '@app/core/plugins/hooks.service'
14import { PluginService } from '@app/core/plugins/plugin.service'
14 15
15@Component({ 16@Component({
16 selector: 'my-search', 17 selector: 'my-search',
@@ -43,7 +44,8 @@ export class SearchComponent implements OnInit, OnDestroy {
43 private notifier: Notifier, 44 private notifier: Notifier,
44 private searchService: SearchService, 45 private searchService: SearchService,
45 private authService: AuthService, 46 private authService: AuthService,
46 private hooks: HooksService 47 private hooks: HooksService,
48 private pluginService: PluginService
47 ) { } 49 ) { }
48 50
49 get user () { 51 get user () {
@@ -51,6 +53,8 @@ export class SearchComponent implements OnInit, OnDestroy {
51 } 53 }
52 54
53 ngOnInit () { 55 ngOnInit () {
56 this.pluginService.loadPluginsByScope('search')
57
54 this.subActivatedRoute = this.route.queryParams.subscribe( 58 this.subActivatedRoute = this.route.queryParams.subscribe(
55 queryParams => { 59 queryParams => {
56 const querySearch = queryParams['search'] 60 const querySearch = queryParams['search']
@@ -175,7 +179,7 @@ export class SearchComponent implements OnInit, OnDestroy {
175 return this.hooks.wrapObsFun( 179 return this.hooks.wrapObsFun(
176 this.searchService.searchVideos.bind(this.searchService), 180 this.searchService.searchVideos.bind(this.searchService),
177 params, 181 params,
178 'common', 182 'search',
179 'filter:api.search.videos.list.params', 183 'filter:api.search.videos.list.params',
180 'filter:api.search.videos.list.result' 184 'filter:api.search.videos.list.result'
181 ) 185 )
@@ -190,7 +194,7 @@ export class SearchComponent implements OnInit, OnDestroy {
190 return this.hooks.wrapObsFun( 194 return this.hooks.wrapObsFun(
191 this.searchService.searchVideoChannels.bind(this.searchService), 195 this.searchService.searchVideoChannels.bind(this.searchService),
192 params, 196 params,
193 'common', 197 'search',
194 'filter:api.search.video-channels.list.params', 198 'filter:api.search.video-channels.list.params',
195 'filter:api.search.video-channels.list.result' 199 'filter:api.search.video-channels.list.result'
196 ) 200 )
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 eb608a1a3..550d42fa8 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
@@ -52,7 +52,7 @@ export class VideoCommentService {
52 videoId: number | string, 52 videoId: number | string,
53 componentPagination: ComponentPagination, 53 componentPagination: ComponentPagination,
54 sort: VideoSortField 54 sort: VideoSortField
55 }): Observable<{ comments: VideoComment[], totalComments: number}> { 55 }): Observable<ResultList<VideoComment>> {
56 const { videoId, componentPagination, sort } = parameters 56 const { videoId, componentPagination, sort } = parameters
57 57
58 const pagination = this.restService.componentPaginationToRestPagination(componentPagination) 58 const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
@@ -61,10 +61,9 @@ export class VideoCommentService {
61 params = this.restService.addRestGetParams(params, pagination, sort) 61 params = this.restService.addRestGetParams(params, pagination, sort)
62 62
63 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' 63 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
64 return this.authHttp 64 return this.authHttp.get<ResultList<VideoComment>>(url, { params })
65 .get(url, { params })
66 .pipe( 65 .pipe(
67 map(this.extractVideoComments), 66 map(result => this.extractVideoComments(result)),
68 catchError(err => this.restExtractor.handleError(err)) 67 catchError(err => this.restExtractor.handleError(err))
69 ) 68 )
70 } 69 }
@@ -136,7 +135,7 @@ export class VideoCommentService {
136 comments.push(new VideoComment(videoCommentJson)) 135 comments.push(new VideoComment(videoCommentJson))
137 } 136 }
138 137
139 return { comments, totalComments } 138 return { data: comments, total: totalComments }
140 } 139 }
141 140
142 private extractVideoCommentTree (tree: VideoCommentThreadTree) { 141 private extractVideoCommentTree (tree: VideoCommentThreadTree) {
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 3c1a0986c..5bafc55e5 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
@@ -122,8 +122,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
122 122
123 obs.subscribe( 123 obs.subscribe(
124 res => { 124 res => {
125 this.comments = this.comments.concat(res.comments) 125 this.comments = this.comments.concat(res.data)
126 this.componentPagination.totalItems = res.totalComments 126 this.componentPagination.totalItems = res.total
127 }, 127 },
128 128
129 err => this.notifier.error(err.message) 129 err => this.notifier.error(err.message)
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index eed2ec048..0d9b6d680 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -103,7 +103,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
103 } 103 }
104 104
105 async ngOnInit () { 105 async ngOnInit () {
106 await this.pluginService.loadPluginsByScope('video-watch') 106 this.pluginService.loadPluginsByScope('video-watch')
107 107
108 this.configSub = this.serverService.configLoaded 108 this.configSub = this.serverService.configLoaded
109 .subscribe(() => { 109 .subscribe(() => {