diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-22 15:40:13 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 93cae47925e4dd68b7d34a41927b2740b4fab1b4 (patch) | |
tree | f649ab49fab1886b434e164591990cc99b234466 /client/src/app/videos | |
parent | 587568e1cc0e33c023c1ac62dd28fef313285250 (diff) | |
download | PeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.tar.gz PeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.tar.zst PeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.zip |
Add client hooks
Diffstat (limited to 'client/src/app/videos')
10 files changed, 138 insertions, 51 deletions
diff --git a/client/src/app/videos/+video-edit/video-update.resolver.ts b/client/src/app/videos/+video-edit/video-update.resolver.ts index 384458127..4ac517d96 100644 --- a/client/src/app/videos/+video-edit/video-update.resolver.ts +++ b/client/src/app/videos/+video-edit/video-update.resolver.ts | |||
@@ -18,7 +18,7 @@ export class VideoUpdateResolver implements Resolve<any> { | |||
18 | resolve (route: ActivatedRouteSnapshot) { | 18 | resolve (route: ActivatedRouteSnapshot) { |
19 | const uuid: string = route.params[ 'uuid' ] | 19 | const uuid: string = route.params[ 'uuid' ] |
20 | 20 | ||
21 | return this.videoService.getVideo(uuid) | 21 | return this.videoService.getVideo({ videoId: uuid }) |
22 | .pipe( | 22 | .pipe( |
23 | switchMap(video => { | 23 | switchMap(video => { |
24 | return forkJoin([ | 24 | return forkJoin([ |
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 b8e5878c5..eb608a1a3 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 | |||
@@ -48,11 +48,13 @@ export class VideoCommentService { | |||
48 | ) | 48 | ) |
49 | } | 49 | } |
50 | 50 | ||
51 | getVideoCommentThreads ( | 51 | getVideoCommentThreads (parameters: { |
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<{ comments: VideoComment[], totalComments: number}> { |
56 | const { videoId, componentPagination, sort } = parameters | ||
57 | |||
56 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 58 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
57 | 59 | ||
58 | let params = new HttpParams() | 60 | let params = new HttpParams() |
@@ -67,7 +69,11 @@ export class VideoCommentService { | |||
67 | ) | 69 | ) |
68 | } | 70 | } |
69 | 71 | ||
70 | getVideoThreadComments (videoId: number | string, threadId: number): Observable<VideoCommentThreadTree> { | 72 | getVideoThreadComments (parameters: { |
73 | videoId: number | string, | ||
74 | threadId: number | ||
75 | }): Observable<VideoCommentThreadTree> { | ||
76 | const { videoId, threadId } = parameters | ||
71 | const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` | 77 | const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` |
72 | 78 | ||
73 | return this.authHttp | 79 | return this.authHttp |
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 3acddbe6a..3c1a0986c 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 | |||
@@ -12,6 +12,7 @@ import { VideoComment } from './video-comment.model' | |||
12 | import { VideoCommentService } from './video-comment.service' | 12 | import { VideoCommentService } from './video-comment.service' |
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 13 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Syndication } from '@app/shared/video/syndication.model' | 14 | import { Syndication } from '@app/shared/video/syndication.model' |
15 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-comments', | 18 | selector: 'my-video-comments', |
@@ -45,7 +46,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
45 | private confirmService: ConfirmService, | 46 | private confirmService: ConfirmService, |
46 | private videoCommentService: VideoCommentService, | 47 | private videoCommentService: VideoCommentService, |
47 | private activatedRoute: ActivatedRoute, | 48 | private activatedRoute: ActivatedRoute, |
48 | private i18n: I18n | 49 | private i18n: I18n, |
50 | private hooks: HooksService | ||
49 | ) {} | 51 | ) {} |
50 | 52 | ||
51 | ngOnInit () { | 53 | ngOnInit () { |
@@ -73,8 +75,20 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
73 | viewReplies (commentId: number, highlightThread = false) { | 75 | viewReplies (commentId: number, highlightThread = false) { |
74 | this.threadLoading[commentId] = true | 76 | this.threadLoading[commentId] = true |
75 | 77 | ||
76 | this.videoCommentService.getVideoThreadComments(this.video.id, commentId) | 78 | const params = { |
77 | .subscribe( | 79 | videoId: this.video.id, |
80 | threadId: commentId | ||
81 | } | ||
82 | |||
83 | const obs = this.hooks.wrapObsFun( | ||
84 | this.videoCommentService.getVideoThreadComments.bind(this.videoCommentService), | ||
85 | params, | ||
86 | 'video-watch', | ||
87 | 'filter:api.video-watch.video-thread-replies.list.params', | ||
88 | 'filter:api.video-watch.video-thread-replies.list.result' | ||
89 | ) | ||
90 | |||
91 | obs.subscribe( | ||
78 | res => { | 92 | res => { |
79 | this.threadComments[commentId] = res | 93 | this.threadComments[commentId] = res |
80 | this.threadLoading[commentId] = false | 94 | this.threadLoading[commentId] = false |
@@ -91,16 +105,29 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
91 | ) | 105 | ) |
92 | } | 106 | } |
93 | 107 | ||
94 | loadMoreComments () { | 108 | loadMoreThreads () { |
95 | this.videoCommentService.getVideoCommentThreads(this.video.id, this.componentPagination, this.sort) | 109 | const params = { |
96 | .subscribe( | 110 | videoId: this.video.id, |
97 | res => { | 111 | componentPagination: this.componentPagination, |
98 | this.comments = this.comments.concat(res.comments) | 112 | sort: this.sort |
99 | this.componentPagination.totalItems = res.totalComments | 113 | } |
100 | }, | ||
101 | 114 | ||
102 | err => this.notifier.error(err.message) | 115 | const obs = this.hooks.wrapObsFun( |
103 | ) | 116 | this.videoCommentService.getVideoCommentThreads.bind(this.videoCommentService), |
117 | params, | ||
118 | 'video-watch', | ||
119 | 'filter:api.video-watch.video-threads.list.params', | ||
120 | 'filter:api.video-watch.video-threads.list.result' | ||
121 | ) | ||
122 | |||
123 | obs.subscribe( | ||
124 | res => { | ||
125 | this.comments = this.comments.concat(res.comments) | ||
126 | this.componentPagination.totalItems = res.totalComments | ||
127 | }, | ||
128 | |||
129 | err => this.notifier.error(err.message) | ||
130 | ) | ||
104 | } | 131 | } |
105 | 132 | ||
106 | onCommentThreadCreated (comment: VideoComment) { | 133 | onCommentThreadCreated (comment: VideoComment) { |
@@ -169,7 +196,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
169 | this.componentPagination.currentPage++ | 196 | this.componentPagination.currentPage++ |
170 | 197 | ||
171 | if (hasMoreItems(this.componentPagination)) { | 198 | if (hasMoreItems(this.componentPagination)) { |
172 | this.loadMoreComments() | 199 | this.loadMoreThreads() |
173 | } | 200 | } |
174 | } | 201 | } |
175 | 202 | ||
@@ -197,7 +224,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
197 | 224 | ||
198 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) | 225 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) |
199 | 226 | ||
200 | this.loadMoreComments() | 227 | this.loadMoreThreads() |
201 | } | 228 | } |
202 | } | 229 | } |
203 | 230 | ||
diff --git a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts index bccdaf7b2..2fb0cb0e5 100644 --- a/client/src/app/videos/+video-watch/video-watch-playlist.component.ts +++ b/client/src/app/videos/+video-watch/video-watch-playlist.component.ts | |||
@@ -66,11 +66,11 @@ export class VideoWatchPlaylistComponent { | |||
66 | 66 | ||
67 | loadPlaylistElements (playlist: VideoPlaylist, redirectToFirst = false) { | 67 | loadPlaylistElements (playlist: VideoPlaylist, redirectToFirst = false) { |
68 | this.videoService.getPlaylistVideos(playlist.uuid, this.playlistPagination) | 68 | this.videoService.getPlaylistVideos(playlist.uuid, this.playlistPagination) |
69 | .subscribe(({ totalVideos, videos }) => { | 69 | .subscribe(({ total, data }) => { |
70 | this.playlistVideos = this.playlistVideos.concat(videos) | 70 | this.playlistVideos = this.playlistVideos.concat(data) |
71 | this.playlistPagination.totalItems = totalVideos | 71 | this.playlistPagination.totalItems = total |
72 | 72 | ||
73 | if (totalVideos === 0) { | 73 | if (total === 0) { |
74 | this.noPlaylistVideos = true | 74 | this.noPlaylistVideos = true |
75 | return | 75 | return |
76 | } | 76 | } |
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 6d8bb4b3f..eed2ec048 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -33,6 +33,7 @@ import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' | |||
33 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' | 33 | import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' |
34 | import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' | 34 | import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' |
35 | import { PluginService } from '@app/core/plugins/plugin.service' | 35 | import { PluginService } from '@app/core/plugins/plugin.service' |
36 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
36 | 37 | ||
37 | @Component({ | 38 | @Component({ |
38 | selector: 'my-video-watch', | 39 | selector: 'my-video-watch', |
@@ -93,6 +94,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
93 | private videoCaptionService: VideoCaptionService, | 94 | private videoCaptionService: VideoCaptionService, |
94 | private i18n: I18n, | 95 | private i18n: I18n, |
95 | private hotkeysService: HotkeysService, | 96 | private hotkeysService: HotkeysService, |
97 | private hooks: HooksService, | ||
96 | @Inject(LOCALE_ID) private localeId: string | 98 | @Inject(LOCALE_ID) private localeId: string |
97 | ) {} | 99 | ) {} |
98 | 100 | ||
@@ -131,7 +133,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
131 | 133 | ||
132 | this.theaterEnabled = getStoredTheater() | 134 | this.theaterEnabled = getStoredTheater() |
133 | 135 | ||
134 | this.pluginService.runHook('action:video-watch.loaded') | 136 | this.hooks.runAction('action:video-watch.init') |
135 | } | 137 | } |
136 | 138 | ||
137 | ngOnDestroy () { | 139 | ngOnDestroy () { |
@@ -246,9 +248,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
246 | 248 | ||
247 | if (this.player) this.player.pause() | 249 | if (this.player) this.player.pause() |
248 | 250 | ||
251 | const videoObs = this.hooks.wrapObsFun( | ||
252 | this.videoService.getVideo.bind(this.videoService), | ||
253 | { videoId }, | ||
254 | 'video-watch', | ||
255 | 'filter:api.video-watch.video.get.params', | ||
256 | 'filter:api.video-watch.video.get.result' | ||
257 | ) | ||
258 | |||
249 | // Video did change | 259 | // Video did change |
250 | forkJoin( | 260 | forkJoin( |
251 | this.videoService.getVideo(videoId), | 261 | videoObs, |
252 | this.videoCaptionService.listCaptions(videoId) | 262 | this.videoCaptionService.listCaptions(videoId) |
253 | ) | 263 | ) |
254 | .pipe( | 264 | .pipe( |
@@ -486,6 +496,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
486 | 496 | ||
487 | this.setOpenGraphTags() | 497 | this.setOpenGraphTags() |
488 | this.checkUserRating() | 498 | this.checkUserRating() |
499 | |||
500 | this.hooks.runAction('action:video-watch.video.loaded') | ||
489 | } | 501 | } |
490 | 502 | ||
491 | private setRating (nextRating: UserVideoRateType) { | 503 | private setRating (nextRating: UserVideoRateType) { |
diff --git a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts index f975ff6ef..a1e65c27c 100644 --- a/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts +++ b/client/src/app/videos/recommendations/recent-videos-recommendation.service.ts | |||
@@ -33,20 +33,24 @@ export class RecentVideosRecommendationService implements RecommendationService | |||
33 | private fetchPage (page: number, recommendation: RecommendationInfo): Observable<Video[]> { | 33 | private fetchPage (page: number, recommendation: RecommendationInfo): Observable<Video[]> { |
34 | const pagination = { currentPage: page, itemsPerPage: this.pageSize + 1 } | 34 | const pagination = { currentPage: page, itemsPerPage: this.pageSize + 1 } |
35 | const defaultSubscription = this.videos.getVideos({ videoPagination: pagination, sort: '-createdAt' }) | 35 | const defaultSubscription = this.videos.getVideos({ videoPagination: pagination, sort: '-createdAt' }) |
36 | .pipe(map(v => v.videos)) | 36 | .pipe(map(v => v.data)) |
37 | 37 | ||
38 | if (!recommendation.tags || recommendation.tags.length === 0) return defaultSubscription | 38 | if (!recommendation.tags || recommendation.tags.length === 0) return defaultSubscription |
39 | 39 | ||
40 | return this.searchService.searchVideos('', | 40 | const params = { |
41 | pagination, | 41 | search: '', |
42 | new AdvancedSearch({ tagsOneOf: recommendation.tags.join(','), sort: '-createdAt' }) | 42 | componentPagination: pagination, |
43 | ).pipe( | 43 | advancedSearch: new AdvancedSearch({ tagsOneOf: recommendation.tags.join(','), sort: '-createdAt' }) |
44 | map(v => v.videos), | 44 | } |
45 | switchMap(videos => { | 45 | |
46 | if (videos.length <= 1) return defaultSubscription | 46 | return this.searchService.searchVideos(params) |
47 | 47 | .pipe( | |
48 | return of(videos) | 48 | map(v => v.data), |
49 | }) | 49 | switchMap(videos => { |
50 | ) | 50 | if (videos.length <= 1) return defaultSubscription |
51 | |||
52 | return of(videos) | ||
53 | }) | ||
54 | ) | ||
51 | } | 55 | } |
52 | } | 56 | } |
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 5de4a13af..81b6ce493 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -10,6 +10,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
10 | import { ScreenService } from '@app/shared/misc/screen.service' | 10 | import { ScreenService } from '@app/shared/misc/screen.service' |
11 | import { UserRight } from '../../../../../shared/models/users' | 11 | import { UserRight } from '../../../../../shared/models/users' |
12 | import { Notifier, ServerService } from '@app/core' | 12 | import { Notifier, ServerService } from '@app/core' |
13 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
13 | 14 | ||
14 | @Component({ | 15 | @Component({ |
15 | selector: 'my-videos-local', | 16 | selector: 'my-videos-local', |
@@ -31,7 +32,8 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
31 | protected notifier: Notifier, | 32 | protected notifier: Notifier, |
32 | protected authService: AuthService, | 33 | protected authService: AuthService, |
33 | protected screenService: ScreenService, | 34 | protected screenService: ScreenService, |
34 | private videoService: VideoService | 35 | private videoService: VideoService, |
36 | private hooks: HooksService | ||
35 | ) { | 37 | ) { |
36 | super() | 38 | super() |
37 | 39 | ||
@@ -55,14 +57,21 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
55 | 57 | ||
56 | getVideosObservable (page: number) { | 58 | getVideosObservable (page: number) { |
57 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 59 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
58 | 60 | const params = { | |
59 | return this.videoService.getVideos({ | ||
60 | videoPagination: newPagination, | 61 | videoPagination: newPagination, |
61 | sort: this.sort, | 62 | sort: this.sort, |
62 | filter: this.filter, | 63 | filter: this.filter, |
63 | categoryOneOf: this.categoryOneOf, | 64 | categoryOneOf: this.categoryOneOf, |
64 | languageOneOf: this.languageOneOf | 65 | languageOneOf: this.languageOneOf |
65 | }) | 66 | } |
67 | |||
68 | return this.hooks.wrapObsFun( | ||
69 | this.videoService.getVideos.bind(this.videoService), | ||
70 | params, | ||
71 | 'common', | ||
72 | 'filter:api.videos.list.local.params', | ||
73 | 'filter:api.videos.list.local.result' | ||
74 | ) | ||
66 | } | 75 | } |
67 | 76 | ||
68 | generateSyndicationList () { | 77 | generateSyndicationList () { |
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index 19522e6b4..638e7caed 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts | |||
@@ -8,6 +8,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | import { ScreenService } from '@app/shared/misc/screen.service' | 9 | import { ScreenService } from '@app/shared/misc/screen.service' |
10 | import { Notifier, ServerService } from '@app/core' | 10 | import { Notifier, ServerService } from '@app/core' |
11 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
11 | 12 | ||
12 | @Component({ | 13 | @Component({ |
13 | selector: 'my-videos-recently-added', | 14 | selector: 'my-videos-recently-added', |
@@ -29,7 +30,8 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
29 | protected notifier: Notifier, | 30 | protected notifier: Notifier, |
30 | protected authService: AuthService, | 31 | protected authService: AuthService, |
31 | protected screenService: ScreenService, | 32 | protected screenService: ScreenService, |
32 | private videoService: VideoService | 33 | private videoService: VideoService, |
34 | private hooks: HooksService | ||
33 | ) { | 35 | ) { |
34 | super() | 36 | super() |
35 | 37 | ||
@@ -48,14 +50,20 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
48 | 50 | ||
49 | getVideosObservable (page: number) { | 51 | getVideosObservable (page: number) { |
50 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 52 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
51 | 53 | const params = { | |
52 | return this.videoService.getVideos({ | ||
53 | videoPagination: newPagination, | 54 | videoPagination: newPagination, |
54 | sort: this.sort, | 55 | sort: this.sort, |
55 | filter: undefined, | ||
56 | categoryOneOf: this.categoryOneOf, | 56 | categoryOneOf: this.categoryOneOf, |
57 | languageOneOf: this.languageOneOf | 57 | languageOneOf: this.languageOneOf |
58 | }) | 58 | } |
59 | |||
60 | return this.hooks.wrapObsFun( | ||
61 | this.videoService.getVideos.bind(this.videoService), | ||
62 | params, | ||
63 | 'common', | ||
64 | 'filter:api.videos.list.recently-added.params', | ||
65 | 'filter:api.videos.list.recently-added.result' | ||
66 | ) | ||
59 | } | 67 | } |
60 | 68 | ||
61 | generateSyndicationList () { | 69 | generateSyndicationList () { |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 5f1d5055b..0e69bfd64 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -8,6 +8,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 8 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | import { ScreenService } from '@app/shared/misc/screen.service' | 9 | import { ScreenService } from '@app/shared/misc/screen.service' |
10 | import { Notifier, ServerService } from '@app/core' | 10 | import { Notifier, ServerService } from '@app/core' |
11 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
11 | 12 | ||
12 | @Component({ | 13 | @Component({ |
13 | selector: 'my-videos-trending', | 14 | selector: 'my-videos-trending', |
@@ -28,7 +29,8 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
28 | protected notifier: Notifier, | 29 | protected notifier: Notifier, |
29 | protected authService: AuthService, | 30 | protected authService: AuthService, |
30 | protected screenService: ScreenService, | 31 | protected screenService: ScreenService, |
31 | private videoService: VideoService | 32 | private videoService: VideoService, |
33 | private hooks: HooksService | ||
32 | ) { | 34 | ) { |
33 | super() | 35 | super() |
34 | } | 36 | } |
@@ -61,13 +63,20 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
61 | 63 | ||
62 | getVideosObservable (page: number) { | 64 | getVideosObservable (page: number) { |
63 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 65 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
64 | return this.videoService.getVideos({ | 66 | const params = { |
65 | videoPagination: newPagination, | 67 | videoPagination: newPagination, |
66 | sort: this.sort, | 68 | sort: this.sort, |
67 | filter: undefined, | ||
68 | categoryOneOf: this.categoryOneOf, | 69 | categoryOneOf: this.categoryOneOf, |
69 | languageOneOf: this.languageOneOf | 70 | languageOneOf: this.languageOneOf |
70 | }) | 71 | } |
72 | |||
73 | return this.hooks.wrapObsFun( | ||
74 | this.videoService.getVideos.bind(this.videoService), | ||
75 | params, | ||
76 | 'common', | ||
77 | 'filter:api.videos.list.trending.params', | ||
78 | 'filter:api.videos.list.trending.result' | ||
79 | ) | ||
71 | } | 80 | } |
72 | 81 | ||
73 | generateSyndicationList () { | 82 | generateSyndicationList () { |
diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts index 3caa371d8..ac325aeff 100644 --- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts | |||
@@ -9,6 +9,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
9 | import { ScreenService } from '@app/shared/misc/screen.service' | 9 | import { ScreenService } from '@app/shared/misc/screen.service' |
10 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | 10 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' |
11 | import { Notifier, ServerService } from '@app/core' | 11 | import { Notifier, ServerService } from '@app/core' |
12 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-videos-user-subscriptions', | 15 | selector: 'my-videos-user-subscriptions', |
@@ -29,7 +30,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
29 | protected notifier: Notifier, | 30 | protected notifier: Notifier, |
30 | protected authService: AuthService, | 31 | protected authService: AuthService, |
31 | protected screenService: ScreenService, | 32 | protected screenService: ScreenService, |
32 | private videoService: VideoService | 33 | private videoService: VideoService, |
34 | private hooks: HooksService | ||
33 | ) { | 35 | ) { |
34 | super() | 36 | super() |
35 | 37 | ||
@@ -46,8 +48,18 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
46 | 48 | ||
47 | getVideosObservable (page: number) { | 49 | getVideosObservable (page: number) { |
48 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 50 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
51 | const params = { | ||
52 | videoPagination: newPagination, | ||
53 | sort: this.sort | ||
54 | } | ||
49 | 55 | ||
50 | return this.videoService.getUserSubscriptionVideos(newPagination, this.sort) | 56 | return this.hooks.wrapObsFun( |
57 | this.videoService.getUserSubscriptionVideos.bind(this.videoService), | ||
58 | params, | ||
59 | 'common', | ||
60 | 'filter:api.videos.list.user-subscriptions.params', | ||
61 | 'filter:api.videos.list.user-subscriptions.result' | ||
62 | ) | ||
51 | } | 63 | } |
52 | 64 | ||
53 | generateSyndicationList () { | 65 | generateSyndicationList () { |