From a68ccaead667f1b976e0fb10c8b1087af25547f2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Jan 2023 15:04:10 +0100 Subject: (breaking): Always list nsfw videos in playlists Keep the same behaviour as unlisted videos The frontend is in charge to blur the video element if the nsfw setting is "hide" or "blur" --- server/controllers/api/video-playlist.ts | 7 ++--- server/models/video/video-playlist-element.ts | 39 +++++++++++++-------------- server/tests/api/videos/video-playlists.ts | 15 +---------- 3 files changed, 22 insertions(+), 39 deletions(-) (limited to 'server') diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index f8a607170..947f7ca77 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts @@ -15,7 +15,7 @@ import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/vid import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' import { VideoPlaylistUpdate } from '../../../shared/models/videos/playlist/video-playlist-update.model' import { resetSequelizeInstance } from '../../helpers/database-utils' -import { buildNSFWFilter, createReqFiles } from '../../helpers/express-utils' +import { createReqFiles } from '../../helpers/express-utils' import { logger } from '../../helpers/logger' import { getFormattedObjects } from '../../helpers/utils' import { CONFIG } from '../../initializers/config' @@ -474,10 +474,7 @@ async function getVideoPlaylistVideos (req: express.Request, res: express.Respon 'filter:api.video-playlist.videos.list.result' ) - const options = { - displayNSFW: buildNSFWFilter(res, req.query.nsfw), - accountId: user ? user.Account.id : undefined - } + const options = { accountId: user?.Account?.id } return res.json(getFormattedObjects(resultList.data, resultList.total, options)) } diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts index 48f4ed5a9..b832f9768 100644 --- a/server/models/video/video-playlist-element.ts +++ b/server/models/video/video-playlist-element.ts @@ -309,7 +309,23 @@ export class VideoPlaylistElementModel extends Model e.position === 3) - - expect(element).to.exist - expect(element.video).to.be.null - expect(element.type).to.equal(VideoPlaylistElementType.UNAVAILABLE) - }) - }) describe('Managing playlist elements', function () { -- cgit v1.2.3