Fix ownership change
This commit is contained in:
parent
1ca9f7c3f7
commit
f92e7f76d4
4 changed files with 12 additions and 10 deletions
|
@ -15,7 +15,7 @@ import { forwardVideoRelatedActivity } from '../send/utils'
|
||||||
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
|
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
|
||||||
import { createOrUpdateVideoPlaylist } from '../playlist'
|
import { createOrUpdateVideoPlaylist } from '../playlist'
|
||||||
import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
|
import { APProcessorOptions } from '../../../typings/activitypub-processor.model'
|
||||||
import { MActorSignature } from '../../../typings/models'
|
import { MActorSignature, MAccountIdActor } from '../../../typings/models'
|
||||||
|
|
||||||
async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
|
async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
|
||||||
const { activity, byActor } = options
|
const { activity, byActor } = options
|
||||||
|
@ -64,10 +64,13 @@ async function processUpdateVideo (actor: MActorSignature, activity: ActivityUpd
|
||||||
const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id, allowRefresh: false, fetchType: 'all' })
|
const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id, allowRefresh: false, fetchType: 'all' })
|
||||||
const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject)
|
const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject)
|
||||||
|
|
||||||
|
const account = actor.Account as MAccountIdActor
|
||||||
|
account.Actor = actor
|
||||||
|
|
||||||
const updateOptions = {
|
const updateOptions = {
|
||||||
video,
|
video,
|
||||||
videoObject,
|
videoObject,
|
||||||
account: channelActor.VideoChannel.Account,
|
account,
|
||||||
channel: channelActor.VideoChannel,
|
channel: channelActor.VideoChannel,
|
||||||
overrideTo: activity.to
|
overrideTo: activity.to
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,13 +53,13 @@ import { FilteredModelAttributes } from '../../typings/sequelize'
|
||||||
import { autoBlacklistVideoIfNeeded } from '../video-blacklist'
|
import { autoBlacklistVideoIfNeeded } from '../video-blacklist'
|
||||||
import { ActorFollowScoreCache } from '../files-cache'
|
import { ActorFollowScoreCache } from '../files-cache'
|
||||||
import {
|
import {
|
||||||
MAccountActor,
|
MAccountIdActor,
|
||||||
MChannelAccountLight,
|
MChannelAccountLight,
|
||||||
MChannelDefault,
|
MChannelDefault,
|
||||||
MChannelId,
|
MChannelId,
|
||||||
MVideo,
|
MVideo,
|
||||||
MVideoAccountLightBlacklistAllFiles,
|
|
||||||
MVideoAccountLight,
|
MVideoAccountLight,
|
||||||
|
MVideoAccountLightBlacklistAllFiles,
|
||||||
MVideoAP,
|
MVideoAP,
|
||||||
MVideoAPWithoutCaption,
|
MVideoAPWithoutCaption,
|
||||||
MVideoFile,
|
MVideoFile,
|
||||||
|
@ -265,7 +265,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: {
|
||||||
async function updateVideoFromAP (options: {
|
async function updateVideoFromAP (options: {
|
||||||
video: MVideoAccountLightBlacklistAllFiles,
|
video: MVideoAccountLightBlacklistAllFiles,
|
||||||
videoObject: VideoTorrentObject,
|
videoObject: VideoTorrentObject,
|
||||||
account: MAccountActor,
|
account: MAccountIdActor,
|
||||||
channel: MChannelDefault,
|
channel: MChannelDefault,
|
||||||
overrideTo?: string[]
|
overrideTo?: string[]
|
||||||
}) {
|
}) {
|
||||||
|
|
|
@ -191,7 +191,7 @@ describe('Test video change ownership - nominal', function () {
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have video channel updated', async function () {
|
it('Should have the channel of the video updated', async function () {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const res = await getVideo(server.url, servers[0].video.uuid)
|
const res = await getVideo(server.url, servers[0].video.uuid)
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import { AccountModel } from '../../../models/account/account'
|
import { AccountModel } from '../../../models/account/account'
|
||||||
import {
|
import {
|
||||||
MActor,
|
MActor,
|
||||||
MActorAccountChannelId,
|
|
||||||
MActorAPI,
|
MActorAPI,
|
||||||
MActorAudience,
|
MActorAudience,
|
||||||
MActorDefault,
|
MActorDefault,
|
||||||
MActorDefaultLight,
|
MActorDefaultLight,
|
||||||
|
MActorFormattable,
|
||||||
MActorId,
|
MActorId,
|
||||||
MActorServer,
|
MActorServer,
|
||||||
MActorSummary,
|
MActorSummary,
|
||||||
MActorSummaryFormattable,
|
MActorSummaryFormattable,
|
||||||
MActorUrl,
|
MActorUrl
|
||||||
MActorFormattable
|
|
||||||
} from './actor'
|
} from './actor'
|
||||||
import { FunctionProperties, PickWith } from '../../utils'
|
import { FunctionProperties, PickWith } from '../../utils'
|
||||||
import { MAccountBlocklistId } from './account-blocklist'
|
import { MAccountBlocklistId } from './account-blocklist'
|
||||||
|
@ -35,7 +34,7 @@ export type MAccountUrl = Use<'Actor', MActorUrl>
|
||||||
export type MAccountAudience = Use<'Actor', MActorAudience>
|
export type MAccountAudience = Use<'Actor', MActorAudience>
|
||||||
|
|
||||||
export type MAccountIdActor = MAccountId &
|
export type MAccountIdActor = MAccountId &
|
||||||
Use<'Actor', MActorAccountChannelId>
|
Use<'Actor', MActor>
|
||||||
|
|
||||||
export type MAccountIdActorId = MAccountId &
|
export type MAccountIdActorId = MAccountId &
|
||||||
Use<'Actor', MActorId>
|
Use<'Actor', MActorId>
|
||||||
|
|
Loading…
Reference in a new issue