From 32fde390f465b9ceef9e49c4037acdacbe176d65 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Jan 2023 14:09:57 +0100 Subject: [PATCH] Use unknown when category is not set Unstead of Misc, that could be a real category --- scripts/i18n/create-custom-files.ts | 1 - server/models/video/formatter/video-format-utils.ts | 2 +- server/tests/api/videos/video-imports.ts | 2 +- server/tests/shared/videos.ts | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/i18n/create-custom-files.ts b/scripts/i18n/create-custom-files.ts index 3b5045954..eca2fe09d 100755 --- a/scripts/i18n/create-custom-files.ts +++ b/scripts/i18n/create-custom-files.ts @@ -90,7 +90,6 @@ Object.values(VIDEO_CATEGORIES) // More keys Object.assign(serverKeys, { - Misc: 'Misc', Unknown: 'Unknown' }) diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts index f285db477..6f05dbdc8 100644 --- a/server/models/video/formatter/video-format-utils.ts +++ b/server/models/video/formatter/video-format-utils.ts @@ -488,7 +488,7 @@ function videoModelToActivityPubObject (video: MVideoAP): VideoObject { } function getCategoryLabel (id: number) { - return VIDEO_CATEGORIES[id] || 'Misc' + return VIDEO_CATEGORIES[id] || 'Unknown' } function getLicenceLabel (id: number) { diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 0583134b2..5636de45f 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -41,7 +41,7 @@ async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMag const videoTorrent = await server.videos.get({ id: idTorrent }) for (const video of [ videoMagnet, videoTorrent ]) { - expect(video.category.label).to.equal('Misc') + expect(video.category.label).to.equal('Unknown') expect(video.licence.label).to.equal('Unknown') expect(video.language.label).to.equal('Unknown') expect(video.nsfw).to.be.false diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts index c8339584b..f8ec65752 100644 --- a/server/tests/shared/videos.ts +++ b/server/tests/shared/videos.ts @@ -59,7 +59,7 @@ async function completeVideoCheck ( expect(video.name).to.equal(attributes.name) expect(video.category.id).to.equal(attributes.category) - expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Misc') + expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Unknown') expect(video.licence.id).to.equal(attributes.licence) expect(video.licence.label).to.equal(attributes.licence !== null ? VIDEO_LICENCES[attributes.licence] : 'Unknown') expect(video.language.id).to.equal(attributes.language) -- 2.41.0