Correctly set tags to replays of permanent lives
This commit is contained in:
parent
486183fe62
commit
5e82c1932e
2 changed files with 18 additions and 2 deletions
|
@ -48,6 +48,7 @@ describe('Save replay setting', function () {
|
||||||
channelId: servers[0].store.channel.id,
|
channelId: servers[0].store.channel.id,
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
name: 'live'.repeat(30),
|
name: 'live'.repeat(30),
|
||||||
|
tags: [ 'tag1', 'tag2' ],
|
||||||
saveReplay: options.replay,
|
saveReplay: options.replay,
|
||||||
replaySettings: options.replaySettings,
|
replaySettings: options.replaySettings,
|
||||||
permanentLive: options.permanent
|
permanentLive: options.permanent
|
||||||
|
@ -134,6 +135,13 @@ describe('Save replay setting', function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkVideoTags (videoId: string, tags: string[]) {
|
||||||
|
for (const server of servers) {
|
||||||
|
const video = await server.videos.get({ id: videoId })
|
||||||
|
expect(video.tags).to.have.members(tags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
|
|
||||||
|
@ -311,6 +319,7 @@ describe('Save replay setting', function () {
|
||||||
await checkVideosExist(liveVideoUUID, 0, HttpStatusCode.OK_200)
|
await checkVideosExist(liveVideoUUID, 0, HttpStatusCode.OK_200)
|
||||||
await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
|
await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
|
||||||
await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.UNLISTED)
|
await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.UNLISTED)
|
||||||
|
await checkVideoTags(liveVideoUUID, [ 'tag1', 'tag2' ])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should find the replay live session', async function () {
|
it('Should find the replay live session', async function () {
|
||||||
|
@ -443,6 +452,8 @@ describe('Save replay setting', function () {
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
await servers[1].videos.get({ id: lastReplayUUID, expectedStatus: HttpStatusCode.OK_200 })
|
await servers[1].videos.get({ id: lastReplayUUID, expectedStatus: HttpStatusCode.OK_200 })
|
||||||
|
|
||||||
|
await checkVideoTags(lastReplayUUID, [ 'tag1', 'tag2' ])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have appropriate ended session and replay live session', async function () {
|
it('Should have appropriate ended session and replay live session', async function () {
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { buildStoryboardJobIfNeeded } from '@server/lib/video-jobs.js'
|
||||||
import { VideoPathManager } from '@server/lib/video-path-manager.js'
|
import { VideoPathManager } from '@server/lib/video-path-manager.js'
|
||||||
import { isVideoInPublicDirectory } from '@server/lib/video-privacy.js'
|
import { isVideoInPublicDirectory } from '@server/lib/video-privacy.js'
|
||||||
import { moveToNextState } from '@server/lib/video-state.js'
|
import { moveToNextState } from '@server/lib/video-state.js'
|
||||||
|
import { setVideoTags } from '@server/lib/video.js'
|
||||||
import { VideoBlacklistModel } from '@server/models/video/video-blacklist.js'
|
import { VideoBlacklistModel } from '@server/models/video/video-blacklist.js'
|
||||||
import { VideoFileModel } from '@server/models/video/video-file.js'
|
import { VideoFileModel } from '@server/models/video/video-file.js'
|
||||||
import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'
|
import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'
|
||||||
|
@ -30,6 +31,7 @@ import {
|
||||||
MVideo,
|
MVideo,
|
||||||
MVideoLive,
|
MVideoLive,
|
||||||
MVideoLiveSession,
|
MVideoLiveSession,
|
||||||
|
MVideoTag,
|
||||||
MVideoThumbnail,
|
MVideoThumbnail,
|
||||||
MVideoWithAllFiles,
|
MVideoWithAllFiles,
|
||||||
MVideoWithFileThumbnail
|
MVideoWithFileThumbnail
|
||||||
|
@ -110,8 +112,9 @@ async function saveReplayToExternalVideo (options: {
|
||||||
publishedAt: string
|
publishedAt: string
|
||||||
replayDirectory: string
|
replayDirectory: string
|
||||||
}) {
|
}) {
|
||||||
const { liveVideo, liveSession, publishedAt, replayDirectory } = options
|
const { liveSession, publishedAt, replayDirectory } = options
|
||||||
|
|
||||||
|
const liveVideo = await VideoModel.loadFull(options.liveVideo.id)
|
||||||
const replaySettings = await VideoLiveReplaySettingModel.load(liveSession.replaySettingId)
|
const replaySettings = await VideoLiveReplaySettingModel.load(liveSession.replaySettingId)
|
||||||
|
|
||||||
const videoNameSuffix = ` - ${new Date(publishedAt).toLocaleString()}`
|
const videoNameSuffix = ` - ${new Date(publishedAt).toLocaleString()}`
|
||||||
|
@ -138,7 +141,7 @@ async function saveReplayToExternalVideo (options: {
|
||||||
support: liveVideo.support,
|
support: liveVideo.support,
|
||||||
privacy: replaySettings.privacy,
|
privacy: replaySettings.privacy,
|
||||||
channelId: liveVideo.channelId
|
channelId: liveVideo.channelId
|
||||||
}) as MVideoWithAllFiles
|
}) as MVideoWithAllFiles & MVideoTag
|
||||||
|
|
||||||
replayVideo.Thumbnails = []
|
replayVideo.Thumbnails = []
|
||||||
replayVideo.VideoFiles = []
|
replayVideo.VideoFiles = []
|
||||||
|
@ -148,6 +151,8 @@ async function saveReplayToExternalVideo (options: {
|
||||||
|
|
||||||
await replayVideo.save()
|
await replayVideo.save()
|
||||||
|
|
||||||
|
await setVideoTags({ video: replayVideo, tags: liveVideo.Tags.map(t => t.name) })
|
||||||
|
|
||||||
liveSession.replayVideoId = replayVideo.id
|
liveSession.replayVideoId = replayVideo.id
|
||||||
await liveSession.save()
|
await liveSession.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue