aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-08 21:52:25 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-08 21:52:25 +0100
commit86e83939869976e9b4dfa6dc9d3785a284bd598c (patch)
tree253fecfc9b8002aaedfc1ad8e53c6d1cf850564e
parentd38b82810638b9f664c9016fac2684454c273a77 (diff)
downloadPeerTube-86e83939869976e9b4dfa6dc9d3785a284bd598c.tar.gz
PeerTube-86e83939869976e9b4dfa6dc9d3785a284bd598c.tar.zst
PeerTube-86e83939869976e9b4dfa6dc9d3785a284bd598c.zip
Allow to sort by likes
-rw-r--r--client/src/app/videos/shared/sort-field.type.ts5
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts1
-rw-r--r--client/src/app/videos/video-list/video-sort.component.ts6
-rw-r--r--server/initializers/constants.js2
4 files changed, 9 insertions, 5 deletions
diff --git a/client/src/app/videos/shared/sort-field.type.ts b/client/src/app/videos/shared/sort-field.type.ts
index 7bda3112a..6cc598d8b 100644
--- a/client/src/app/videos/shared/sort-field.type.ts
+++ b/client/src/app/videos/shared/sort-field.type.ts
@@ -1,3 +1,6 @@
1export type SortField = 'name' | '-name' 1export type SortField = 'name' | '-name'
2 | 'duration' | '-duration' 2 | 'duration' | '-duration'
3 | 'createdAt' | '-createdAt'; 3 | 'createdAt' | '-createdAt'
4 | 'views' | '-views'
5 | 'likes' | '-likes';
6
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts
index 844e14567..ede1b51a9 100644
--- a/client/src/app/videos/video-list/video-list.component.ts
+++ b/client/src/app/videos/video-list/video-list.component.ts
@@ -18,7 +18,6 @@ import { SearchService } from '../../shared';
18 styleUrls: [ './video-list.component.scss' ], 18 styleUrls: [ './video-list.component.scss' ],
19 templateUrl: './video-list.component.html' 19 templateUrl: './video-list.component.html'
20}) 20})
21
22export class VideoListComponent implements OnInit, OnDestroy { 21export class VideoListComponent implements OnInit, OnDestroy {
23 loading: BehaviorSubject<boolean> = new BehaviorSubject(false); 22 loading: BehaviorSubject<boolean> = new BehaviorSubject(false);
24 pagination: RestPagination = { 23 pagination: RestPagination = {
diff --git a/client/src/app/videos/video-list/video-sort.component.ts b/client/src/app/videos/video-list/video-sort.component.ts
index c950fa8aa..cde307f2f 100644
--- a/client/src/app/videos/video-list/video-sort.component.ts
+++ b/client/src/app/videos/video-list/video-sort.component.ts
@@ -12,7 +12,7 @@ export class VideoSortComponent {
12 12
13 @Input() currentSort: SortField; 13 @Input() currentSort: SortField;
14 14
15 sortChoices = { 15 sortChoices: { [ id: SortField ]: string } = {
16 'name': 'Name - Asc', 16 'name': 'Name - Asc',
17 '-name': 'Name - Desc', 17 '-name': 'Name - Desc',
18 'duration': 'Duration - Asc', 18 'duration': 'Duration - Asc',
@@ -20,7 +20,9 @@ export class VideoSortComponent {
20 'createdAt': 'Created Date - Asc', 20 'createdAt': 'Created Date - Asc',
21 '-createdAt': 'Created Date - Desc', 21 '-createdAt': 'Created Date - Desc',
22 'views': 'Views - Asc', 22 'views': 'Views - Asc',
23 '-views': 'Views - Desc' 23 '-views': 'Views - Desc',
24 'likes': 'Likes - Asc',
25 '-likes': 'Likes - Desc'
24 }; 26 };
25 27
26 get choiceKeys() { 28 get choiceKeys() {
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 16a2dd320..f9247e945 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -24,7 +24,7 @@ const SEARCHABLE_COLUMNS = {
24const SORTABLE_COLUMNS = { 24const SORTABLE_COLUMNS = {
25 USERS: [ 'id', 'username', 'createdAt' ], 25 USERS: [ 'id', 'username', 'createdAt' ],
26 VIDEO_ABUSES: [ 'id', 'createdAt' ], 26 VIDEO_ABUSES: [ 'id', 'createdAt' ],
27 VIDEOS: [ 'name', 'duration', 'createdAt', 'views' ] 27 VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ]
28} 28}
29 29
30const OAUTH_LIFETIME = { 30const OAUTH_LIFETIME = {