mirror of https://github.com/Chocobozzz/PeerTube
Correctly set tags to replays of permanent lives
parent
486183fe62
commit
5e82c1932e
|
@ -48,6 +48,7 @@ describe('Save replay setting', function () {
|
|||
channelId: servers[0].store.channel.id,
|
||||
privacy: VideoPrivacy.PUBLIC,
|
||||
name: 'live'.repeat(30),
|
||||
tags: [ 'tag1', 'tag2' ],
|
||||
saveReplay: options.replay,
|
||||
replaySettings: options.replaySettings,
|
||||
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 () {
|
||||
this.timeout(120000)
|
||||
|
||||
|
@ -311,6 +319,7 @@ describe('Save replay setting', function () {
|
|||
await checkVideosExist(liveVideoUUID, 0, HttpStatusCode.OK_200)
|
||||
await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
|
||||
await checkVideoPrivacy(liveVideoUUID, VideoPrivacy.UNLISTED)
|
||||
await checkVideoTags(liveVideoUUID, [ 'tag1', 'tag2' ])
|
||||
})
|
||||
|
||||
it('Should find the replay live session', async function () {
|
||||
|
@ -443,6 +452,8 @@ describe('Save replay setting', function () {
|
|||
await waitJobs(servers)
|
||||
|
||||
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 () {
|
||||
|
|
|
@ -18,6 +18,7 @@ import { buildStoryboardJobIfNeeded } from '@server/lib/video-jobs.js'
|
|||
import { VideoPathManager } from '@server/lib/video-path-manager.js'
|
||||
import { isVideoInPublicDirectory } from '@server/lib/video-privacy.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 { VideoFileModel } from '@server/models/video/video-file.js'
|
||||
import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'
|
||||
|
@ -30,6 +31,7 @@ import {
|
|||
MVideo,
|
||||
MVideoLive,
|
||||
MVideoLiveSession,
|
||||
MVideoTag,
|
||||
MVideoThumbnail,
|
||||
MVideoWithAllFiles,
|
||||
MVideoWithFileThumbnail
|
||||
|
@ -110,8 +112,9 @@ async function saveReplayToExternalVideo (options: {
|
|||
publishedAt: 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 videoNameSuffix = ` - ${new Date(publishedAt).toLocaleString()}`
|
||||
|
@ -138,7 +141,7 @@ async function saveReplayToExternalVideo (options: {
|
|||
support: liveVideo.support,
|
||||
privacy: replaySettings.privacy,
|
||||
channelId: liveVideo.channelId
|
||||
}) as MVideoWithAllFiles
|
||||
}) as MVideoWithAllFiles & MVideoTag
|
||||
|
||||
replayVideo.Thumbnails = []
|
||||
replayVideo.VideoFiles = []
|
||||
|
@ -148,6 +151,8 @@ async function saveReplayToExternalVideo (options: {
|
|||
|
||||
await replayVideo.save()
|
||||
|
||||
await setVideoTags({ video: replayVideo, tags: liveVideo.Tags.map(t => t.name) })
|
||||
|
||||
liveSession.replayVideoId = replayVideo.id
|
||||
await liveSession.save()
|
||||
|
||||
|
|
Loading…
Reference in New Issue