Support commentsPolicy

This commit is contained in:
Chocobozzz 2024-05-31 09:12:21 +02:00
parent 8eb43d3686
commit 4064d313fc
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 16 additions and 1 deletions

View File

@ -169,6 +169,10 @@ export function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DB
support: v.support,
commentsEnabled: v.commentsEnabled,
commentsPolicy: v.commentsPolicy
? { id: v.commentsPolicy.id, label: v.commentsPolicy.label }
: undefined,
downloadEnabled: v.downloadEnabled
}
}
@ -242,5 +246,5 @@ export function formatVideoForAPI (v: DBVideoDetails, fromHost?: string): APIVid
// ---------------------------------------------------------------------------
export function isVideoDetails (video: IndexableVideo | IndexableVideoDetails): video is IndexableVideoDetails {
return (video as IndexableVideoDetails).commentsEnabled !== undefined
return (video as IndexableVideoDetails).support !== undefined
}

View File

@ -7,6 +7,11 @@ export interface IndexableVideo extends Video, IndexableDoc {
}
export interface IndexableVideoDetails extends VideoDetails, IndexableDoc {
// TODO: remove when upgrading types to v6.2
commentsPolicy: {
id: number
label: string
}
}
type IgnoredVideoFields = 'isLocal' | 'createdAt' | 'updatedAt' | 'publishedAt' | 'originallyPublishedAt' | 'channel' | 'account'
@ -35,6 +40,12 @@ export interface DBVideoDetails extends Omit<VideoDetails, IgnoredVideoFields>,
channel: DBChannel
_rankingScore?: number
// TODO: remove when upgrading types to v6.2
commentsPolicy: {
id: number
label: string
}
}
// Results from the search API