aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-27 14:37:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-10-29 11:48:21 +0200
commit2760b454a761f6af3138b2fb5f34340772ab0d1e (patch)
tree2b3a2d81478f8b432eb54cce4caa5a760c494627 /server/models/user
parente4611b54910d8e7f2b4f8a97ee2d9cc8e1054127 (diff)
downloadPeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.gz
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.tar.zst
PeerTube-2760b454a761f6af3138b2fb5f34340772ab0d1e.zip
Deprecate filter video query
Introduce include and isLocal instead
Diffstat (limited to 'server/models/user')
-rw-r--r--server/models/user/user-video-history.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/models/user/user-video-history.ts b/server/models/user/user-video-history.ts
index e3dc4a062..d633cc9d5 100644
--- a/server/models/user/user-video-history.ts
+++ b/server/models/user/user-video-history.ts
@@ -4,6 +4,7 @@ import { MUserAccountId, MUserId } from '@server/types/models'
4import { AttributesOnly } from '@shared/core-utils' 4import { AttributesOnly } from '@shared/core-utils'
5import { VideoModel } from '../video/video' 5import { VideoModel } from '../video/video'
6import { UserModel } from './user' 6import { UserModel } from './user'
7import { getServerActor } from '../application/application'
7 8
8@Table({ 9@Table({
9 tableName: 'userVideoHistory', 10 tableName: 'userVideoHistory',
@@ -56,14 +57,19 @@ export class UserVideoHistoryModel extends Model<Partial<AttributesOnly<UserVide
56 }) 57 })
57 User: UserModel 58 User: UserModel
58 59
59 static listForApi (user: MUserAccountId, start: number, count: number, search?: string) { 60 static async listForApi (user: MUserAccountId, start: number, count: number, search?: string) {
61 const serverActor = await getServerActor()
62
60 return VideoModel.listForApi({ 63 return VideoModel.listForApi({
61 start, 64 start,
62 count, 65 count,
63 search, 66 search,
64 sort: '-"userVideoHistory"."updatedAt"', 67 sort: '-"userVideoHistory"."updatedAt"',
65 nsfw: null, // All 68 nsfw: null, // All
66 includeLocalVideos: true, 69 displayOnlyForFollower: {
70 actorId: serverActor.id,
71 orLocalVideos: true
72 },
67 withFiles: false, 73 withFiles: false,
68 user, 74 user,
69 historyOfUser: user 75 historyOfUser: user