From 38fa2065831b5f55be0d7f30f19a62c967397208 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Nov 2017 14:48:08 +0100 Subject: Remove references to author --- server/controllers/activitypub/videos.ts | 26 +++++++++++++------------- server/controllers/api/users.ts | 8 ++++---- server/controllers/api/videos/channel.ts | 20 ++++++++++---------- server/controllers/api/videos/index.ts | 2 +- server/controllers/client.ts | 4 ++-- server/controllers/services.ts | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) (limited to 'server/controllers') diff --git a/server/controllers/activitypub/videos.ts b/server/controllers/activitypub/videos.ts index 9a1868ff7..a9b31bf75 100644 --- a/server/controllers/activitypub/videos.ts +++ b/server/controllers/activitypub/videos.ts @@ -32,8 +32,8 @@ // RemoteVideoChannelCreateData, // RemoteVideoChannelUpdateData, // RemoteVideoChannelRemoveData, -// RemoteVideoAuthorRemoveData, -// RemoteVideoAuthorCreateData +// RemoteVideoAccountRemoveData, +// RemoteVideoAccountCreateData // } from '../../../../shared' // import { VideoInstance } from '../../../models/video/video-interface' // @@ -49,8 +49,8 @@ // functionsHash[ENDPOINT_ACTIONS.UPDATE_CHANNEL] = updateRemoteVideoChannelRetryWrapper // functionsHash[ENDPOINT_ACTIONS.REMOVE_CHANNEL] = removeRemoteVideoChannelRetryWrapper // functionsHash[ENDPOINT_ACTIONS.REPORT_ABUSE] = reportAbuseRemoteVideoRetryWrapper -// functionsHash[ENDPOINT_ACTIONS.ADD_AUTHOR] = addRemoteVideoAuthorRetryWrapper -// functionsHash[ENDPOINT_ACTIONS.REMOVE_AUTHOR] = removeRemoteVideoAuthorRetryWrapper +// functionsHash[ENDPOINT_ACTIONS.ADD_ACCOUNT] = addRemoteVideoAccountRetryWrapper +// functionsHash[ENDPOINT_ACTIONS.REMOVE_ACCOUNT] = removeRemoteVideoAccountRetryWrapper // // const remoteVideosRouter = express.Router() // @@ -245,24 +245,24 @@ // logger.info('Remote video with uuid %s removed.', videoToRemoveData.uuid) // } // -// async function removeRemoteVideoAuthorRetryWrapper (authorAttributesToRemove: RemoteVideoAuthorRemoveData, fromPod: PodInstance) { +// async function removeRemoteVideoAccountRetryWrapper (accountAttributesToRemove: RemoteVideoAccountRemoveData, fromPod: PodInstance) { // const options = { -// arguments: [ authorAttributesToRemove, fromPod ], -// errorMessage: 'Cannot remove the remote video author with many retries.' +// arguments: [ accountAttributesToRemove, fromPod ], +// errorMessage: 'Cannot remove the remote video account with many retries.' // } // -// await retryTransactionWrapper(removeRemoteVideoAuthor, options) +// await retryTransactionWrapper(removeRemoteVideoAccount, options) // } // -// async function removeRemoteVideoAuthor (authorAttributesToRemove: RemoteVideoAuthorRemoveData, fromPod: PodInstance) { -// logger.debug('Removing remote video author "%s".', authorAttributesToRemove.uuid) +// async function removeRemoteVideoAccount (accountAttributesToRemove: RemoteVideoAccountRemoveData, fromPod: PodInstance) { +// logger.debug('Removing remote video account "%s".', accountAttributesToRemove.uuid) // // await db.sequelize.transaction(async t => { -// const videoAuthor = await db.Author.loadAuthorByPodAndUUID(authorAttributesToRemove.uuid, fromPod.id, t) -// await videoAuthor.destroy({ transaction: t }) +// const videoAccount = await db.Account.loadAccountByPodAndUUID(accountAttributesToRemove.uuid, fromPod.id, t) +// await videoAccount.destroy({ transaction: t }) // }) // -// logger.info('Remote video author with uuid %s removed.', authorAttributesToRemove.uuid) +// logger.info('Remote video account with uuid %s removed.', accountAttributesToRemove.uuid) // } // // async function removeRemoteVideoChannelRetryWrapper (videoChannelAttributesToRemove: RemoteVideoChannelRemoveData, fromPod: PodInstance) { diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index bacfc4552..9ec6feb57 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts @@ -28,7 +28,7 @@ import { UserRole, UserRight } from '../../../shared' -import { createUserAuthorAndChannel } from '../../lib' +import { createUserAccountAndChannel } from '../../lib' import { UserInstance } from '../../models' import { videosSortValidator } from '../../middlewares/validators/sort' import { setVideosSort } from '../../middlewares/sort' @@ -142,9 +142,9 @@ async function createUser (req: express.Request, res: express.Response, next: ex videoQuota: body.videoQuota }) - await createUserAuthorAndChannel(user) + await createUserAccountAndChannel(user) - logger.info('User %s with its channel and author created.', body.username) + logger.info('User %s with its channel and account created.', body.username) } async function registerUser (req: express.Request, res: express.Response, next: express.NextFunction) { @@ -159,7 +159,7 @@ async function registerUser (req: express.Request, res: express.Response, next: videoQuota: CONFIG.USER.VIDEO_QUOTA }) - await createUserAuthorAndChannel(user) + await createUserAccountAndChannel(user) return res.type('json').status(204).end() } diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts index ab54eedee..4d1f03903 100644 --- a/server/controllers/api/videos/channel.ts +++ b/server/controllers/api/videos/channel.ts @@ -17,14 +17,14 @@ import { videoChannelsRemoveValidator, videoChannelGetValidator, videoChannelsUpdateValidator, - listVideoAuthorChannelsValidator, + listVideoAccountChannelsValidator, asyncMiddleware } from '../../../middlewares' import { createVideoChannel, updateVideoChannelToFriends } from '../../../lib' -import { VideoChannelInstance, AuthorInstance } from '../../../models' +import { VideoChannelInstance, AccountInstance } from '../../../models' import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' const videoChannelRouter = express.Router() @@ -37,9 +37,9 @@ videoChannelRouter.get('/channels', asyncMiddleware(listVideoChannels) ) -videoChannelRouter.get('/authors/:authorId/channels', - listVideoAuthorChannelsValidator, - asyncMiddleware(listVideoAuthorChannels) +videoChannelRouter.get('/accounts/:accountId/channels', + listVideoAccountChannelsValidator, + asyncMiddleware(listVideoAccountChannels) ) videoChannelRouter.post('/channels', @@ -79,8 +79,8 @@ async function listVideoChannels (req: express.Request, res: express.Response, n return res.json(getFormattedObjects(resultList.data, resultList.total)) } -async function listVideoAuthorChannels (req: express.Request, res: express.Response, next: express.NextFunction) { - const resultList = await db.VideoChannel.listByAuthor(res.locals.author.id) +async function listVideoAccountChannels (req: express.Request, res: express.Response, next: express.NextFunction) { + const resultList = await db.VideoChannel.listByAccount(res.locals.account.id) return res.json(getFormattedObjects(resultList.data, resultList.total)) } @@ -101,11 +101,11 @@ async function addVideoChannelRetryWrapper (req: express.Request, res: express.R async function addVideoChannel (req: express.Request, res: express.Response) { const videoChannelInfo: VideoChannelCreate = req.body - const author: AuthorInstance = res.locals.oauth.token.User.Author + const account: AccountInstance = res.locals.oauth.token.User.Account let videoChannelCreated: VideoChannelInstance await db.sequelize.transaction(async t => { - videoChannelCreated = await createVideoChannel(videoChannelInfo, author, t) + videoChannelCreated = await createVideoChannel(videoChannelInfo, account, t) }) logger.info('Video channel with uuid %s created.', videoChannelCreated.uuid) @@ -179,7 +179,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response) } async function getVideoChannel (req: express.Request, res: express.Response, next: express.NextFunction) { - const videoChannelWithVideos = await db.VideoChannel.loadAndPopulateAuthorAndVideos(res.locals.videoChannel.id) + const videoChannelWithVideos = await db.VideoChannel.loadAndPopulateAccountAndVideos(res.locals.videoChannel.id) return res.json(videoChannelWithVideos.toFormattedJSON()) } diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 964db151d..9ad84609f 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -395,7 +395,7 @@ async function removeVideo (req: express.Request, res: express.Response) { } async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { - const resultList = await db.Video.searchAndPopulateAuthorAndPodAndTags( + const resultList = await db.Video.searchAndPopulateAccountAndPodAndTags( req.params.value, req.query.field, req.query.start, diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 67ebfcf1d..40dda7584 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts @@ -110,9 +110,9 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons // Let Angular application handle errors if (validator.isUUID(videoId, 4)) { - videoPromise = db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(videoId) + videoPromise = db.Video.loadByUUIDAndPopulateAccountAndPodAndTags(videoId) } else if (validator.isInt(videoId)) { - videoPromise = db.Video.loadAndPopulateAuthorAndPodAndTags(+videoId) + videoPromise = db.Video.loadAndPopulateAccountAndPodAndTags(+videoId) } else { return res.sendFile(indexPath) } diff --git a/server/controllers/services.ts b/server/controllers/services.ts index 99a33a716..0db6e5498 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts @@ -47,7 +47,7 @@ function generateOEmbed (req: express.Request, res: express.Response, next: expr width: embedWidth, height: embedHeight, title: video.name, - author_name: video.VideoChannel.Author.name, + author_name: video.VideoChannel.Account.name, provider_name: 'PeerTube', provider_url: webserverUrl } -- cgit v1.2.3