From 7b87d2d5141d0eb48db2a3fd162208d6a79b2035 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Apr 2018 10:56:27 +0200 Subject: Handle sort in rss --- .../videos/+video-watch/comment/video-comment.service.ts | 4 ++-- .../videos/+video-watch/comment/video-comments.component.ts | 4 ++-- client/src/app/videos/video-list/video-local.component.ts | 13 ++++++------- .../app/videos/video-list/video-recently-added.component.ts | 8 +++----- .../src/app/videos/video-list/video-trending.component.ts | 6 +++--- 5 files changed, 16 insertions(+), 19 deletions(-) (limited to 'client/src/app/videos') 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 { import { environment } from '../../../../environments/environment' import { RestExtractor, RestService } from '../../../shared/rest' import { ComponentPagination } from '../../../shared/rest/component-pagination.model' -import { SortField } from '../../../shared/video/sort-field.type' +import { VideoSortField } from '../../../shared/video/sort-field.type' import { VideoComment } from './video-comment.model' @Injectable() @@ -48,7 +48,7 @@ export class VideoCommentService { getVideoCommentThreads ( videoId: number | string, componentPagination: ComponentPagination, - sort: SortField + sort: VideoSortField ): Observable<{ comments: VideoComment[], totalComments: number}> { const pagination = this.restService.componentPaginationToRestPagination(componentPagination) 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 import { AuthService } from '../../../core/auth' import { ComponentPagination } from '../../../shared/rest/component-pagination.model' import { User } from '../../../shared/users' -import { SortField } from '../../../shared/video/sort-field.type' +import { VideoSortField } from '../../../shared/video/sort-field.type' import { VideoDetails } from '../../../shared/video/video-details.model' import { VideoComment } from './video-comment.model' import { VideoCommentService } from './video-comment.service' @@ -23,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { comments: VideoComment[] = [] highlightedThread: VideoComment - sort: SortField = '-createdAt' + sort: VideoSortField = '-createdAt' componentPagination: ComponentPagination = { currentPage: 1, 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' import { immutableAssign } from '@app/shared/misc/utils' import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' -import { PopoverModule } from 'ngx-bootstrap/popover' import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { SortField } from '../../shared/video/sort-field.type' +import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' -import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' -import * as url from 'url' +import { VideoFilter } from '../../../../../shared/models/videos/video-query.type' @Component({ selector: 'my-videos-local', @@ -18,7 +16,8 @@ import * as url from 'url' export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Local videos' currentRoute = '/videos/local' - sort = '-createdAt' as SortField + sort = '-createdAt' as VideoSortField + filter: VideoFilter = 'local' constructor (protected router: Router, protected route: ActivatedRoute, @@ -41,10 +40,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On getVideosObservable (page: number) { const newPagination = immutableAssign(this.pagination, { currentPage: page }) - return this.videoService.getVideos(newPagination, this.sort, 'local') + return this.videoService.getVideos(newPagination, this.sort, this.filter) } generateSyndicationList () { - this.syndicationItems = this.videoService.getVideoFeedUrls('local') + this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter) } } 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' import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { SortField } from '../../shared/video/sort-field.type' +import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' -import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' -import * as url from 'url' @Component({ selector: 'my-videos-recently-added', @@ -17,7 +15,7 @@ import * as url from 'url' export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Recently added' currentRoute = '/videos/recently-added' - sort: SortField = '-createdAt' + sort: VideoSortField = '-createdAt' constructor (protected router: Router, protected route: ActivatedRoute, @@ -44,6 +42,6 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On } generateSyndicationList () { - this.syndicationItems = this.videoService.getVideoFeedUrls() + this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort) } } 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' import { NotificationsService } from 'angular2-notifications' import { AuthService } from '../../core/auth' import { AbstractVideoList } from '../../shared/video/abstract-video-list' -import { SortField } from '../../shared/video/sort-field.type' +import { VideoSortField } from '../../shared/video/sort-field.type' import { VideoService } from '../../shared/video/video.service' @Component({ @@ -15,7 +15,7 @@ import { VideoService } from '../../shared/video/video.service' export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Trending' currentRoute = '/videos/trending' - defaultSort: SortField = '-views' + defaultSort: VideoSortField = '-views' constructor (protected router: Router, protected route: ActivatedRoute, @@ -41,6 +41,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, } generateSyndicationList () { - this.syndicationItems = this.videoService.getVideoFeedUrls() + this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort) } } -- cgit v1.2.3