add best trending strategy based on Reddit's best

inspired from https://www.reddit.com/r/changelog/comments/7spgg0/best_is_the_new_hotness/
this implementation only adds freshness, and doesn't personalize based
on subscribed communities yet.
This commit is contained in:
Rigel Kent
2021-02-02 12:59:41 +01:00
committed by Chocobozzz
parent f6267b6101
commit 3d4e112d16
15 changed files with 57 additions and 22 deletions

View File

@@ -141,7 +141,7 @@ describe('Test config API validators', function () {
trending: {
videos: {
algorithms: {
enabled: [ 'hot', 'most-viewed', 'most-liked' ],
enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
default: 'most-viewed'
}
}

View File

@@ -375,7 +375,7 @@ describe('Test config', function () {
trending: {
videos: {
algorithms: {
enabled: [ 'hot', 'most-viewed', 'most-liked' ],
enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
default: 'hot'
}
}

View File

@@ -363,6 +363,14 @@ describe('Test a single server', function () {
expect(videos.length).to.equal(2)
})
it('Should list and sort by best in descending order', async function () {
const res = await getVideosListPagination(server.url, 0, 2, '-best')
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(videos.length).to.equal(2)
})
it('Should update a video', async function () {
const attributes = {
name: 'my super video updated',