aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/user/user-video-history.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/user/user-video-history.ts')
-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