From 136cce4d6744bef7fd316b929157c1e4e3984fe3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 May 2018 08:47:47 +0200 Subject: [PATCH] Use publishedAt by default in videos sort --- client/src/app/shared/video/abstract-video-list.ts | 4 ++-- client/src/app/shared/video/sort-field.type.ts | 1 + client/src/app/videos/video-list/video-local.component.ts | 2 +- .../app/videos/video-list/video-recently-added.component.ts | 2 +- server/initializers/constants.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 642a85f65..d8a4b03af 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts @@ -24,8 +24,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { itemsPerPage: 10, totalItems: null } - sort: VideoSortField = '-createdAt' - defaultSort: VideoSortField = '-createdAt' + sort: VideoSortField = '-publishedAt' + defaultSort: VideoSortField = '-publishedAt' syndicationItems = [] loadOnInit = true diff --git a/client/src/app/shared/video/sort-field.type.ts b/client/src/app/shared/video/sort-field.type.ts index 2a3ae4ddd..2192745b9 100644 --- a/client/src/app/shared/video/sort-field.type.ts +++ b/client/src/app/shared/video/sort-field.type.ts @@ -1,5 +1,6 @@ export type VideoSortField = 'name' | '-name' | 'duration' | '-duration' + | 'publishedAt' | '-publishedAt' | 'createdAt' | '-createdAt' | 'views' | '-views' | 'likes' | '-likes' 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 fd67be67b..abab7504f 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts @@ -17,7 +17,7 @@ import { VideoFilter } from '../../../../../shared/models/videos/video-query.typ export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Local videos' currentRoute = '/videos/local' - sort = '-createdAt' as VideoSortField + sort = '-publishedAt' as VideoSortField filter: VideoFilter = 'local' constructor (protected router: Router, 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 535b6e618..d064d9628 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 @@ -16,7 +16,7 @@ import { VideoService } from '../../shared/video/video.service' export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { titlePage = 'Recently added' currentRoute = '/videos/recently-added' - sort: VideoSortField = '-createdAt' + sort: VideoSortField = '-publishedAt' constructor (protected router: Router, protected route: ActivatedRoute, diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 6c9b78068..5a7d91160 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -30,7 +30,7 @@ const SORTABLE_COLUMNS = { JOBS: [ 'createdAt' ], VIDEO_ABUSES: [ 'id', 'createdAt' ], VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], - VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ], + VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes' ], VIDEO_COMMENT_THREADS: [ 'createdAt' ], BLACKLISTS: [ 'id', 'name', 'duration', 'views', 'likes', 'dislikes', 'uuid', 'createdAt' ], FOLLOWERS: [ 'createdAt' ], -- 2.25.1