diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-17 10:56:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-17 10:56:27 +0200 |
commit | 7b87d2d5141d0eb48db2a3fd162208d6a79b2035 (patch) | |
tree | 6c7b40ae79671fa2cf1b8418092acca031006d07 /client/src/app/videos | |
parent | cc1561f9f7b33d739d66b23bacae23ea49f2fa12 (diff) | |
download | PeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.tar.gz PeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.tar.zst PeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.zip |
Handle sort in rss
Diffstat (limited to 'client/src/app/videos')
5 files changed, 16 insertions, 19 deletions
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 470af1230..0bf7696fe 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 | |||
@@ -14,7 +14,7 @@ import { | |||
14 | import { environment } from '../../../../environments/environment' | 14 | import { environment } from '../../../../environments/environment' |
15 | import { RestExtractor, RestService } from '../../../shared/rest' | 15 | import { RestExtractor, RestService } from '../../../shared/rest' |
16 | import { ComponentPagination } from '../../../shared/rest/component-pagination.model' | 16 | import { ComponentPagination } from '../../../shared/rest/component-pagination.model' |
17 | import { SortField } from '../../../shared/video/sort-field.type' | 17 | import { VideoSortField } from '../../../shared/video/sort-field.type' |
18 | import { VideoComment } from './video-comment.model' | 18 | import { VideoComment } from './video-comment.model' |
19 | 19 | ||
20 | @Injectable() | 20 | @Injectable() |
@@ -48,7 +48,7 @@ export class VideoCommentService { | |||
48 | getVideoCommentThreads ( | 48 | getVideoCommentThreads ( |
49 | videoId: number | string, | 49 | videoId: number | string, |
50 | componentPagination: ComponentPagination, | 50 | componentPagination: ComponentPagination, |
51 | sort: SortField | 51 | sort: VideoSortField |
52 | ): Observable<{ comments: VideoComment[], totalComments: number}> { | 52 | ): Observable<{ comments: VideoComment[], totalComments: number}> { |
53 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) | 53 | const pagination = this.restService.componentPaginationToRestPagination(componentPagination) |
54 | 54 | ||
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 711a01ba0..a77a6e9f3 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 | |||
@@ -7,7 +7,7 @@ import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/v | |||
7 | import { AuthService } from '../../../core/auth' | 7 | import { AuthService } from '../../../core/auth' |
8 | import { ComponentPagination } from '../../../shared/rest/component-pagination.model' | 8 | import { ComponentPagination } from '../../../shared/rest/component-pagination.model' |
9 | import { User } from '../../../shared/users' | 9 | import { User } from '../../../shared/users' |
10 | import { SortField } from '../../../shared/video/sort-field.type' | 10 | import { VideoSortField } from '../../../shared/video/sort-field.type' |
11 | import { VideoDetails } from '../../../shared/video/video-details.model' | 11 | import { VideoDetails } from '../../../shared/video/video-details.model' |
12 | import { VideoComment } from './video-comment.model' | 12 | import { VideoComment } from './video-comment.model' |
13 | import { VideoCommentService } from './video-comment.service' | 13 | import { VideoCommentService } from './video-comment.service' |
@@ -23,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
23 | 23 | ||
24 | comments: VideoComment[] = [] | 24 | comments: VideoComment[] = [] |
25 | highlightedThread: VideoComment | 25 | highlightedThread: VideoComment |
26 | sort: SortField = '-createdAt' | 26 | sort: VideoSortField = '-createdAt' |
27 | componentPagination: ComponentPagination = { | 27 | componentPagination: ComponentPagination = { |
28 | currentPage: 1, | 28 | currentPage: 1, |
29 | itemsPerPage: 10, | 29 | itemsPerPage: 10, |
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 90eb96afe..de6552875 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -3,12 +3,10 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
6 | import { PopoverModule } from 'ngx-bootstrap/popover' | ||
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
8 | import { SortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
9 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
10 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | 9 | import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' |
11 | import * as url from 'url' | ||
12 | 10 | ||
13 | @Component({ | 11 | @Component({ |
14 | selector: 'my-videos-local', | 12 | selector: 'my-videos-local', |
@@ -18,7 +16,8 @@ import * as url from 'url' | |||
18 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { | 16 | export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { |
19 | titlePage = 'Local videos' | 17 | titlePage = 'Local videos' |
20 | currentRoute = '/videos/local' | 18 | currentRoute = '/videos/local' |
21 | sort = '-createdAt' as SortField | 19 | sort = '-createdAt' as VideoSortField |
20 | filter: VideoFilter = 'local' | ||
22 | 21 | ||
23 | constructor (protected router: Router, | 22 | constructor (protected router: Router, |
24 | protected route: ActivatedRoute, | 23 | protected route: ActivatedRoute, |
@@ -41,10 +40,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
41 | getVideosObservable (page: number) { | 40 | getVideosObservable (page: number) { |
42 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | 41 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) |
43 | 42 | ||
44 | return this.videoService.getVideos(newPagination, this.sort, 'local') | 43 | return this.videoService.getVideos(newPagination, this.sort, this.filter) |
45 | } | 44 | } |
46 | 45 | ||
47 | generateSyndicationList () { | 46 | generateSyndicationList () { |
48 | this.syndicationItems = this.videoService.getVideoFeedUrls('local') | 47 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter) |
49 | } | 48 | } |
50 | } | 49 | } |
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 3b8108b00..cca35d0f5 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 | |||
@@ -4,10 +4,8 @@ import { immutableAssign } from '@app/shared/misc/utils' | |||
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7 | import { SortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
8 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
9 | import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' | ||
10 | import * as url from 'url' | ||
11 | 9 | ||
12 | @Component({ | 10 | @Component({ |
13 | selector: 'my-videos-recently-added', | 11 | selector: 'my-videos-recently-added', |
@@ -17,7 +15,7 @@ import * as url from 'url' | |||
17 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { | 15 | export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { |
18 | titlePage = 'Recently added' | 16 | titlePage = 'Recently added' |
19 | currentRoute = '/videos/recently-added' | 17 | currentRoute = '/videos/recently-added' |
20 | sort: SortField = '-createdAt' | 18 | sort: VideoSortField = '-createdAt' |
21 | 19 | ||
22 | constructor (protected router: Router, | 20 | constructor (protected router: Router, |
23 | protected route: ActivatedRoute, | 21 | protected route: ActivatedRoute, |
@@ -44,6 +42,6 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
44 | } | 42 | } |
45 | 43 | ||
46 | generateSyndicationList () { | 44 | generateSyndicationList () { |
47 | this.syndicationItems = this.videoService.getVideoFeedUrls() | 45 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort) |
48 | } | 46 | } |
49 | } | 47 | } |
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 6358ef91f..0c9e28216 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -4,7 +4,7 @@ import { immutableAssign } from '@app/shared/misc/utils' | |||
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { NotificationsService } from 'angular2-notifications' |
5 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
7 | import { SortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
8 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
9 | 9 | ||
10 | @Component({ | 10 | @Component({ |
@@ -15,7 +15,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
15 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { | 15 | export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { |
16 | titlePage = 'Trending' | 16 | titlePage = 'Trending' |
17 | currentRoute = '/videos/trending' | 17 | currentRoute = '/videos/trending' |
18 | defaultSort: SortField = '-views' | 18 | defaultSort: VideoSortField = '-views' |
19 | 19 | ||
20 | constructor (protected router: Router, | 20 | constructor (protected router: Router, |
21 | protected route: ActivatedRoute, | 21 | protected route: ActivatedRoute, |
@@ -41,6 +41,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
41 | } | 41 | } |
42 | 42 | ||
43 | generateSyndicationList () { | 43 | generateSyndicationList () { |
44 | this.syndicationItems = this.videoService.getVideoFeedUrls() | 44 | this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort) |
45 | } | 45 | } |
46 | } | 46 | } |