Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Allow to sort by likes

Chocobozzz86e839398699
diff --git a/client/src/app/videos/shared/sort-field.type.ts b/client/src/app/videos/shared/sort-field.type.ts
index 7bda3112a1..6cc598d8b6 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 @@
export type SortField = 'name' | '-name'
| 'duration' | '-duration'
- | 'createdAt' | '-createdAt';
+ | 'createdAt' | '-createdAt'
+ | 'views' | '-views'
+ | 'likes' | '-likes';
+
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 844e145678..ede1b51a95 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';
styleUrls: [ './video-list.component.scss' ],
templateUrl: './video-list.component.html'
})
-
export class VideoListComponent implements OnInit, OnDestroy {
loading: BehaviorSubject<boolean> = new BehaviorSubject(false);
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 c950fa8aa0..cde307f2ff 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 {
@Input() currentSort: SortField;
- sortChoices = {
+ sortChoices: { [ id: SortField ]: string } = {
'name': 'Name - Asc',
'-name': 'Name - Desc',
'duration': 'Duration - Asc',
@@ -20,7 +20,9 @@ export class VideoSortComponent {
'createdAt': 'Created Date - Asc',
'-createdAt': 'Created Date - Desc',
'views': 'Views - Asc',
- '-views': 'Views - Desc'
+ '-views': 'Views - Desc',
+ 'likes': 'Likes - Asc',
+ '-likes': 'Likes - Desc'
};
get choiceKeys() {
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 16a2dd3207..f9247e9450 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -24,7 +24,7 @@ const SEARCHABLE_COLUMNS = {
const SORTABLE_COLUMNS = {
USERS: [ 'id', 'username', 'createdAt' ],
VIDEO_ABUSES: [ 'id', 'createdAt' ],
- VIDEOS: [ 'name', 'duration', 'createdAt', 'views' ]
+ VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ]
}
const OAUTH_LIFETIME = {