From 4064d313fca72720414fee0050da068e65462fe5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 May 2024 09:12:21 +0200 Subject: [PATCH] Support commentsPolicy --- server/lib/meilisearch/meilisearch-videos.ts | 6 +++++- server/types/video.model.ts | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/server/lib/meilisearch/meilisearch-videos.ts b/server/lib/meilisearch/meilisearch-videos.ts index 5be4ad9..7d4e663 100644 --- a/server/lib/meilisearch/meilisearch-videos.ts +++ b/server/lib/meilisearch/meilisearch-videos.ts @@ -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 } diff --git a/server/types/video.model.ts b/server/types/video.model.ts index 38e1327..9ec5eb6 100644 --- a/server/types/video.model.ts +++ b/server/types/video.model.ts @@ -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, channel: DBChannel _rankingScore?: number + + // TODO: remove when upgrading types to v6.2 + commentsPolicy: { + id: number + label: string + } } // Results from the search API