diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-21 08:57:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-21 08:57:00 +0200 |
commit | f92e7f76d43cbad173be87f47105b9a02032318a (patch) | |
tree | 2b18ff4d3cd863ff0f91adf7ca80fd7a2f5b3d05 /server | |
parent | 1ca9f7c3f7afac2af4c4c25b98426731f7e789c6 (diff) | |
download | PeerTube-f92e7f76d43cbad173be87f47105b9a02032318a.tar.gz PeerTube-f92e7f76d43cbad173be87f47105b9a02032318a.tar.zst PeerTube-f92e7f76d43cbad173be87f47105b9a02032318a.zip |
Fix ownership change
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/activitypub/process/process-update.ts | 7 | ||||
-rw-r--r-- | server/lib/activitypub/videos.ts | 6 | ||||
-rw-r--r-- | server/tests/api/videos/video-change-ownership.ts | 2 | ||||
-rw-r--r-- | server/typings/models/account/account.ts | 7 |
4 files changed, 12 insertions, 10 deletions
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 9f80a0ce9..a47d605d8 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts | |||
@@ -15,7 +15,7 @@ import { forwardVideoRelatedActivity } from '../send/utils' | |||
15 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' | 15 | import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' |
16 | import { createOrUpdateVideoPlaylist } from '../playlist' | 16 | import { createOrUpdateVideoPlaylist } from '../playlist' |
17 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' | 17 | import { APProcessorOptions } from '../../../typings/activitypub-processor.model' |
18 | import { MActorSignature } from '../../../typings/models' | 18 | import { MActorSignature, MAccountIdActor } from '../../../typings/models' |
19 | 19 | ||
20 | async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { | 20 | async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { |
21 | const { activity, byActor } = options | 21 | const { activity, byActor } = options |
@@ -64,10 +64,13 @@ async function processUpdateVideo (actor: MActorSignature, activity: ActivityUpd | |||
64 | const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id, allowRefresh: false, fetchType: 'all' }) | 64 | const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id, allowRefresh: false, fetchType: 'all' }) |
65 | const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) | 65 | const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) |
66 | 66 | ||
67 | const account = actor.Account as MAccountIdActor | ||
68 | account.Actor = actor | ||
69 | |||
67 | const updateOptions = { | 70 | const updateOptions = { |
68 | video, | 71 | video, |
69 | videoObject, | 72 | videoObject, |
70 | account: channelActor.VideoChannel.Account, | 73 | account, |
71 | channel: channelActor.VideoChannel, | 74 | channel: channelActor.VideoChannel, |
72 | overrideTo: activity.to | 75 | overrideTo: activity.to |
73 | } | 76 | } |
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 970a953fc..c318978fd 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -53,13 +53,13 @@ import { FilteredModelAttributes } from '../../typings/sequelize' | |||
53 | import { autoBlacklistVideoIfNeeded } from '../video-blacklist' | 53 | import { autoBlacklistVideoIfNeeded } from '../video-blacklist' |
54 | import { ActorFollowScoreCache } from '../files-cache' | 54 | import { ActorFollowScoreCache } from '../files-cache' |
55 | import { | 55 | import { |
56 | MAccountActor, | 56 | MAccountIdActor, |
57 | MChannelAccountLight, | 57 | MChannelAccountLight, |
58 | MChannelDefault, | 58 | MChannelDefault, |
59 | MChannelId, | 59 | MChannelId, |
60 | MVideo, | 60 | MVideo, |
61 | MVideoAccountLightBlacklistAllFiles, | ||
62 | MVideoAccountLight, | 61 | MVideoAccountLight, |
62 | MVideoAccountLightBlacklistAllFiles, | ||
63 | MVideoAP, | 63 | MVideoAP, |
64 | MVideoAPWithoutCaption, | 64 | MVideoAPWithoutCaption, |
65 | MVideoFile, | 65 | MVideoFile, |
@@ -265,7 +265,7 @@ async function getOrCreateVideoAndAccountAndChannel (options: { | |||
265 | async function updateVideoFromAP (options: { | 265 | async function updateVideoFromAP (options: { |
266 | video: MVideoAccountLightBlacklistAllFiles, | 266 | video: MVideoAccountLightBlacklistAllFiles, |
267 | videoObject: VideoTorrentObject, | 267 | videoObject: VideoTorrentObject, |
268 | account: MAccountActor, | 268 | account: MAccountIdActor, |
269 | channel: MChannelDefault, | 269 | channel: MChannelDefault, |
270 | overrideTo?: string[] | 270 | overrideTo?: string[] |
271 | }) { | 271 | }) { |
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index 3a3add71b..64ee2355a 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -191,7 +191,7 @@ describe('Test video change ownership - nominal', function () { | |||
191 | await waitJobs(servers) | 191 | await waitJobs(servers) |
192 | }) | 192 | }) |
193 | 193 | ||
194 | it('Should have video channel updated', async function () { | 194 | it('Should have the channel of the video updated', async function () { |
195 | for (const server of servers) { | 195 | for (const server of servers) { |
196 | const res = await getVideo(server.url, servers[0].video.uuid) | 196 | const res = await getVideo(server.url, servers[0].video.uuid) |
197 | 197 | ||
diff --git a/server/typings/models/account/account.ts b/server/typings/models/account/account.ts index 33940517e..cd20fe81b 100644 --- a/server/typings/models/account/account.ts +++ b/server/typings/models/account/account.ts | |||
@@ -1,17 +1,16 @@ | |||
1 | import { AccountModel } from '../../../models/account/account' | 1 | import { AccountModel } from '../../../models/account/account' |
2 | import { | 2 | import { |
3 | MActor, | 3 | MActor, |
4 | MActorAccountChannelId, | ||
5 | MActorAPI, | 4 | MActorAPI, |
6 | MActorAudience, | 5 | MActorAudience, |
7 | MActorDefault, | 6 | MActorDefault, |
8 | MActorDefaultLight, | 7 | MActorDefaultLight, |
8 | MActorFormattable, | ||
9 | MActorId, | 9 | MActorId, |
10 | MActorServer, | 10 | MActorServer, |
11 | MActorSummary, | 11 | MActorSummary, |
12 | MActorSummaryFormattable, | 12 | MActorSummaryFormattable, |
13 | MActorUrl, | 13 | MActorUrl |
14 | MActorFormattable | ||
15 | } from './actor' | 14 | } from './actor' |
16 | import { FunctionProperties, PickWith } from '../../utils' | 15 | import { FunctionProperties, PickWith } from '../../utils' |
17 | import { MAccountBlocklistId } from './account-blocklist' | 16 | import { MAccountBlocklistId } from './account-blocklist' |
@@ -35,7 +34,7 @@ export type MAccountUrl = Use<'Actor', MActorUrl> | |||
35 | export type MAccountAudience = Use<'Actor', MActorAudience> | 34 | export type MAccountAudience = Use<'Actor', MActorAudience> |
36 | 35 | ||
37 | export type MAccountIdActor = MAccountId & | 36 | export type MAccountIdActor = MAccountId & |
38 | Use<'Actor', MActorAccountChannelId> | 37 | Use<'Actor', MActor> |
39 | 38 | ||
40 | export type MAccountIdActorId = MAccountId & | 39 | export type MAccountIdActorId = MAccountId & |
41 | Use<'Actor', MActorId> | 40 | Use<'Actor', MActorId> |