diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-22 10:43:11 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-22 10:43:11 +0200 |
commit | 5c5e587307a27e173333789b5b5167d35f468b01 (patch) | |
tree | 94e3721caf2e11d38fd5f4112c0fc98da89ac535 /server/controllers/api/video-channel.ts | |
parent | 1b42d73f44811eec1b7ddd72dd0d640a57c3376c (diff) | |
parent | b5fecbf44192144d1ca27c23a0b53922de288c10 (diff) | |
download | PeerTube-5c5e587307a27e173333789b5b5167d35f468b01.tar.gz PeerTube-5c5e587307a27e173333789b5b5167d35f468b01.tar.zst PeerTube-5c5e587307a27e173333789b5b5167d35f468b01.zip |
Merge branch 'feature/strong-model-types' into develop
Diffstat (limited to 'server/controllers/api/video-channel.ts')
-rw-r--r-- | server/controllers/api/video-channel.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 81a03a62b..acc5b2987 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -19,7 +19,7 @@ import { VideoChannelModel } from '../../models/video/video-channel' | |||
19 | import { videoChannelsNameWithHostValidator, videosSortValidator } from '../../middlewares/validators' | 19 | import { videoChannelsNameWithHostValidator, videosSortValidator } from '../../middlewares/validators' |
20 | import { sendUpdateActor } from '../../lib/activitypub/send' | 20 | import { sendUpdateActor } from '../../lib/activitypub/send' |
21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | 21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
22 | import { createVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' | 22 | import { createLocalVideoChannel, federateAllVideosOfChannel } from '../../lib/video-channel' |
23 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 23 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
24 | import { setAsyncActorKeys } from '../../lib/activitypub' | 24 | import { setAsyncActorKeys } from '../../lib/activitypub' |
25 | import { AccountModel } from '../../models/account/account' | 25 | import { AccountModel } from '../../models/account/account' |
@@ -35,6 +35,7 @@ import { VideoPlaylistModel } from '../../models/video/video-playlist' | |||
35 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' | 35 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' |
36 | import { CONFIG } from '../../initializers/config' | 36 | import { CONFIG } from '../../initializers/config' |
37 | import { sequelizeTypescript } from '../../initializers/database' | 37 | import { sequelizeTypescript } from '../../initializers/database' |
38 | import { MChannelAccountDefault } from '@server/typings/models' | ||
38 | 39 | ||
39 | const auditLogger = auditLoggerFactory('channels') | 40 | const auditLogger = auditLoggerFactory('channels') |
40 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 41 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) |
@@ -136,10 +137,10 @@ async function updateVideoChannelAvatar (req: express.Request, res: express.Resp | |||
136 | async function addVideoChannel (req: express.Request, res: express.Response) { | 137 | async function addVideoChannel (req: express.Request, res: express.Response) { |
137 | const videoChannelInfo: VideoChannelCreate = req.body | 138 | const videoChannelInfo: VideoChannelCreate = req.body |
138 | 139 | ||
139 | const videoChannelCreated: VideoChannelModel = await sequelizeTypescript.transaction(async t => { | 140 | const videoChannelCreated = await sequelizeTypescript.transaction(async t => { |
140 | const account = await AccountModel.load(res.locals.oauth.token.User.Account.id, t) | 141 | const account = await AccountModel.load(res.locals.oauth.token.User.Account.id, t) |
141 | 142 | ||
142 | return createVideoChannel(videoChannelInfo, account, t) | 143 | return createLocalVideoChannel(videoChannelInfo, account, t) |
143 | }) | 144 | }) |
144 | 145 | ||
145 | setAsyncActorKeys(videoChannelCreated.Actor) | 146 | setAsyncActorKeys(videoChannelCreated.Actor) |
@@ -181,7 +182,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response) | |||
181 | } | 182 | } |
182 | } | 183 | } |
183 | 184 | ||
184 | const videoChannelInstanceUpdated = await videoChannelInstance.save(sequelizeOptions) | 185 | const videoChannelInstanceUpdated = await videoChannelInstance.save(sequelizeOptions) as MChannelAccountDefault |
185 | await sendUpdateActor(videoChannelInstanceUpdated, t) | 186 | await sendUpdateActor(videoChannelInstanceUpdated, t) |
186 | 187 | ||
187 | auditLogger.update( | 188 | auditLogger.update( |