aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-12 11:05:11 +0200
committerChocobozzz <me@florianbigard.com>2022-08-16 10:33:27 +0200
commit0e6cd1c00f71554fe7375a96db693a6983951ba6 (patch)
treebe9b049e047895c88c561202377f6c5e64ae40df /server/models
parent045224d5eb6a41081186c4040bab1570b9d9ad65 (diff)
downloadPeerTube-0e6cd1c00f71554fe7375a96db693a6983951ba6.tar.gz
PeerTube-0e6cd1c00f71554fe7375a96db693a6983951ba6.tar.zst
PeerTube-0e6cd1c00f71554fe7375a96db693a6983951ba6.zip
Add ability to list comments on local videos
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-comment.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts
index 6c5a764bf..1195e47e9 100644
--- a/server/models/video/video-comment.ts
+++ b/server/models/video/video-comment.ts
@@ -14,6 +14,7 @@ import {
14 Table, 14 Table,
15 UpdatedAt 15 UpdatedAt
16} from 'sequelize-typescript' 16} from 'sequelize-typescript'
17import { exists } from '@server/helpers/custom-validators/misc'
17import { getServerActor } from '@server/models/application/application' 18import { getServerActor } from '@server/models/application/application'
18import { MAccount, MAccountId, MUserAccountId } from '@server/types/models' 19import { MAccount, MAccountId, MUserAccountId } from '@server/types/models'
19import { VideoPrivacy } from '@shared/models' 20import { VideoPrivacy } from '@shared/models'
@@ -312,12 +313,13 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment
312 count: number 313 count: number
313 sort: string 314 sort: string
314 315
316 onLocalVideo?: boolean
315 isLocal?: boolean 317 isLocal?: boolean
316 search?: string 318 search?: string
317 searchAccount?: string 319 searchAccount?: string
318 searchVideo?: string 320 searchVideo?: string
319 }) { 321 }) {
320 const { start, count, sort, isLocal, search, searchAccount, searchVideo } = parameters 322 const { start, count, sort, isLocal, search, searchAccount, searchVideo, onLocalVideo } = parameters
321 323
322 const where: WhereOptions = { 324 const where: WhereOptions = {
323 deletedAt: null 325 deletedAt: null
@@ -363,6 +365,10 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment
363 Object.assign(whereVideo, searchAttribute(searchVideo, 'name')) 365 Object.assign(whereVideo, searchAttribute(searchVideo, 'name'))
364 } 366 }
365 367
368 if (exists(onLocalVideo)) {
369 Object.assign(whereVideo, { remote: !onLocalVideo })
370 }
371
366 const getQuery = (forCount: boolean) => { 372 const getQuery = (forCount: boolean) => {
367 return { 373 return {
368 offset: start, 374 offset: start,