From 5cf84858d49f4231cc4efec5e3132f17f65f6cf6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Sep 2018 10:22:10 +0200 Subject: Add federation to ownership change --- server/models/video/video-channel.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'server/models/video/video-channel.ts') diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 475530daf..f4586917e 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -296,6 +296,12 @@ export class VideoChannelModel extends Model { }) } + static loadByIdAndPopulateAccount (id: number) { + return VideoChannelModel.unscoped() + .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) + .findById(id) + } + static loadByIdAndAccount (id: number, accountId: number) { const query = { where: { @@ -304,13 +310,13 @@ export class VideoChannelModel extends Model { } } - return VideoChannelModel + return VideoChannelModel.unscoped() .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) .findOne(query) } static loadAndPopulateAccount (id: number) { - return VideoChannelModel + return VideoChannelModel.unscoped() .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) .findById(id) } @@ -365,7 +371,7 @@ export class VideoChannelModel extends Model { ] } - return VideoChannelModel + return VideoChannelModel.unscoped() .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) .findOne(query) } @@ -390,7 +396,7 @@ export class VideoChannelModel extends Model { ] } - return VideoChannelModel + return VideoChannelModel.unscoped() .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) .findOne(query) } @@ -402,7 +408,7 @@ export class VideoChannelModel extends Model { ] } - return VideoChannelModel + return VideoChannelModel.unscoped() .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEOS ]) .findById(id, options) } -- cgit v1.2.3