aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-28 11:16:08 +0100
committerChocobozzz <me@florianbigard.com>2017-12-28 11:16:08 +0100
commitda854ddd502cd70685ef779c673b9e63757b8aa0 (patch)
tree21501d170cceaa044a5f23449cbd2eb47fd6415d /server/controllers/api
parentf40bbe3146553ef45515ee6b6d93ce6028f045ca (diff)
downloadPeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.gz
PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.tar.zst
PeerTube-da854ddd502cd70685ef779c673b9e63757b8aa0.zip
Propagate old comment on new follow
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/config.ts2
-rw-r--r--server/controllers/api/index.ts8
-rw-r--r--server/controllers/api/jobs.ts2
-rw-r--r--server/controllers/api/oauth-clients.ts5
-rw-r--r--server/controllers/api/server/follows.ts11
-rw-r--r--server/controllers/api/users.ts24
-rw-r--r--server/controllers/api/videos/abuse.ts14
-rw-r--r--server/controllers/api/videos/blacklist.ts16
-rw-r--r--server/controllers/api/videos/channel.ts16
-rw-r--r--server/controllers/api/videos/comment.ts3
-rw-r--r--server/controllers/api/videos/index.ts41
-rw-r--r--server/controllers/api/videos/rate.ts3
12 files changed, 47 insertions, 98 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 5f704f0ee..2f1132904 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { isSignupAllowed } from '../../helpers/utils'
2 3
3import { isSignupAllowed } from '../../helpers'
4import { CONFIG } from '../../initializers' 4import { CONFIG } from '../../initializers'
5import { asyncMiddleware } from '../../middlewares' 5import { asyncMiddleware } from '../../middlewares'
6import { ServerConfig } from '../../../shared' 6import { ServerConfig } from '../../../shared'
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts
index 737ea4602..1fd44ac11 100644
--- a/server/controllers/api/index.ts
+++ b/server/controllers/api/index.ts
@@ -1,13 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2 2import { badRequest } from '../../helpers/utils'
3import { badRequest } from '../../helpers'
4
5import { oauthClientsRouter } from './oauth-clients'
6import { configRouter } from './config' 3import { configRouter } from './config'
4import { jobsRouter } from './jobs'
5import { oauthClientsRouter } from './oauth-clients'
7import { serverRouter } from './server' 6import { serverRouter } from './server'
8import { usersRouter } from './users' 7import { usersRouter } from './users'
9import { videosRouter } from './videos' 8import { videosRouter } from './videos'
10import { jobsRouter } from './jobs'
11 9
12const apiRouter = express.Router() 10const apiRouter = express.Router()
13 11
diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts
index 4e7cd1ee3..d9d6030a4 100644
--- a/server/controllers/api/jobs.ts
+++ b/server/controllers/api/jobs.ts
@@ -1,6 +1,6 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight } from '../../../shared/models/users' 2import { UserRight } from '../../../shared/models/users'
3import { getFormattedObjects } from '../../helpers' 3import { getFormattedObjects } from '../../helpers/utils'
4import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares' 4import { asyncMiddleware, authenticate, ensureUserHasRight, jobsSortValidator, setJobsSort, setPagination } from '../../middlewares'
5import { paginationValidator } from '../../middlewares/validators' 5import { paginationValidator } from '../../middlewares/validators'
6import { JobModel } from '../../models/job/job' 6import { JobModel } from '../../models/job/job'
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts
index bc02fce90..3dcc023e6 100644
--- a/server/controllers/api/oauth-clients.ts
+++ b/server/controllers/api/oauth-clients.ts
@@ -1,9 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2 2import { OAuthClientLocal } from '../../../shared'
3import { logger } from '../../helpers/logger'
3import { CONFIG } from '../../initializers' 4import { CONFIG } from '../../initializers'
4import { logger } from '../../helpers'
5import { asyncMiddleware } from '../../middlewares' 5import { asyncMiddleware } from '../../middlewares'
6import { OAuthClientLocal } from '../../../shared'
7import { OAuthClientModel } from '../../models/oauth/oauth-client' 6import { OAuthClientModel } from '../../models/oauth/oauth-client'
8 7
9const oauthClientsRouter = express.Router() 8const oauthClientsRouter = express.Router()
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index ae5413b75..c87107197 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -1,11 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users' 2import { UserRight } from '../../../../shared/models/users'
3import { 3import { sanitizeHost } from '../../../helpers/core-utils'
4 getFormattedObjects, getServerActor, loadActorUrlOrGetFromWebfinger, logger, retryTransactionWrapper, 4import { retryTransactionWrapper } from '../../../helpers/database-utils'
5 sanitizeHost 5import { logger } from '../../../helpers/logger'
6} from '../../../helpers' 6import { getFormattedObjects, getServerActor } from '../../../helpers/utils'
7import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
7import { REMOTE_SCHEME, sequelizeTypescript, SERVER_ACTOR_NAME } from '../../../initializers' 8import { REMOTE_SCHEME, sequelizeTypescript, SERVER_ACTOR_NAME } from '../../../initializers'
8import { getOrCreateActorAndServerAndModel } from '../../../lib/activitypub' 9import { getOrCreateActorAndServerAndModel } from '../../../lib/activitypub/actor'
9import { sendFollow, sendUndoFollow } from '../../../lib/activitypub/send' 10import { sendFollow, sendUndoFollow } from '../../../lib/activitypub/send'
10import { 11import {
11 asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, removeFollowingValidator, setBodyHostsPort, 12 asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, removeFollowingValidator, setBodyHostsPort,
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index 3106df9b9..75393ad17 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -1,26 +1,14 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared' 2import { UserCreate, UserRight, UserRole, UserUpdate, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../shared'
3import { getFormattedObjects, logger, retryTransactionWrapper } from '../../helpers' 3import { retryTransactionWrapper } from '../../helpers/database-utils'
4import { logger } from '../../helpers/logger'
5import { getFormattedObjects } from '../../helpers/utils'
4import { CONFIG } from '../../initializers' 6import { CONFIG } from '../../initializers'
5import { createUserAccountAndChannel } from '../../lib/user' 7import { createUserAccountAndChannel } from '../../lib/user'
6import { 8import {
7 asyncMiddleware, 9 asyncMiddleware, authenticate, ensureUserHasRight, ensureUserRegistrationAllowed, paginationValidator, setPagination, setUsersSort,
8 authenticate, 10 setVideosSort, token, usersAddValidator, usersGetValidator, usersRegisterValidator, usersRemoveValidator, usersSortValidator,
9 ensureUserHasRight, 11 usersUpdateMeValidator, usersUpdateValidator, usersVideoRatingValidator
10 ensureUserRegistrationAllowed,
11 paginationValidator,
12 setPagination,
13 setUsersSort,
14 setVideosSort,
15 token,
16 usersAddValidator,
17 usersGetValidator,
18 usersRegisterValidator,
19 usersRemoveValidator,
20 usersSortValidator,
21 usersUpdateMeValidator,
22 usersUpdateValidator,
23 usersVideoRatingValidator
24} from '../../middlewares' 12} from '../../middlewares'
25import { videosSortValidator } from '../../middlewares/validators' 13import { videosSortValidator } from '../../middlewares/validators'
26import { AccountVideoRateModel } from '../../models/account/account-video-rate' 14import { AccountVideoRateModel } from '../../models/account/account-video-rate'
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index fecdaf5a3..e78f0f6fc 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -1,17 +1,13 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight, VideoAbuseCreate } from '../../../../shared' 2import { UserRight, VideoAbuseCreate } from '../../../../shared'
3import { getFormattedObjects, logger, retryTransactionWrapper } from '../../../helpers' 3import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { logger } from '../../../helpers/logger'
5import { getFormattedObjects } from '../../../helpers/utils'
4import { sequelizeTypescript } from '../../../initializers' 6import { sequelizeTypescript } from '../../../initializers'
5import { sendVideoAbuse } from '../../../lib/activitypub/send' 7import { sendVideoAbuse } from '../../../lib/activitypub/send'
6import { 8import {
7 asyncMiddleware, 9 asyncMiddleware, authenticate, ensureUserHasRight, paginationValidator, setPagination, setVideoAbusesSort,
8 authenticate, 10 videoAbuseReportValidator, videoAbusesSortValidator
9 ensureUserHasRight,
10 paginationValidator,
11 setPagination,
12 setVideoAbusesSort,
13 videoAbuseReportValidator,
14 videoAbusesSortValidator
15} from '../../../middlewares' 11} from '../../../middlewares'
16import { AccountModel } from '../../../models/account/account' 12import { AccountModel } from '../../../models/account/account'
17import { VideoModel } from '../../../models/video/video' 13import { VideoModel } from '../../../models/video/video'
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index d08c6e13f..c9087fd97 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -1,17 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import { logger, getFormattedObjects } from '../../../helpers' 2import { BlacklistedVideo, UserRight } from '../../../../shared'
3import { logger } from '../../../helpers/logger'
4import { getFormattedObjects } from '../../../helpers/utils'
3import { 5import {
4 authenticate, 6 asyncMiddleware, authenticate, blacklistSortValidator, ensureUserHasRight, paginationValidator, setBlacklistSort, setPagination,
5 ensureUserHasRight, 7 videosBlacklistAddValidator, videosBlacklistRemoveValidator
6 videosBlacklistAddValidator,
7 videosBlacklistRemoveValidator,
8 paginationValidator,
9 blacklistSortValidator,
10 setBlacklistSort,
11 setPagination,
12 asyncMiddleware
13} from '../../../middlewares' 8} from '../../../middlewares'
14import { BlacklistedVideo, UserRight } from '../../../../shared'
15import { VideoBlacklistModel } from '../../../models/video/video-blacklist' 9import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
16 10
17const blacklistRouter = express.Router() 11const blacklistRouter = express.Router()
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts
index cc00d9f8d..7c62b5476 100644
--- a/server/controllers/api/videos/channel.ts
+++ b/server/controllers/api/videos/channel.ts
@@ -1,20 +1,14 @@
1import * as express from 'express' 1import * as express from 'express'
2import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' 2import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared'
3import { getFormattedObjects, logger, resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers' 3import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { logger } from '../../../helpers/logger'
5import { getFormattedObjects, resetSequelizeInstance } from '../../../helpers/utils'
4import { sequelizeTypescript } from '../../../initializers' 6import { sequelizeTypescript } from '../../../initializers'
5import { setAsyncActorKeys } from '../../../lib/activitypub' 7import { setAsyncActorKeys } from '../../../lib/activitypub'
6import { createVideoChannel } from '../../../lib/video-channel' 8import { createVideoChannel } from '../../../lib/video-channel'
7import { 9import {
8 asyncMiddleware, 10 asyncMiddleware, authenticate, listVideoAccountChannelsValidator, paginationValidator, setPagination, setVideoChannelsSort,
9 authenticate, 11 videoChannelsAddValidator, videoChannelsGetValidator, videoChannelsRemoveValidator, videoChannelsSortValidator,
10 listVideoAccountChannelsValidator,
11 paginationValidator,
12 setPagination,
13 setVideoChannelsSort,
14 videoChannelsAddValidator,
15 videoChannelsGetValidator,
16 videoChannelsRemoveValidator,
17 videoChannelsSortValidator,
18 videoChannelsUpdateValidator 12 videoChannelsUpdateValidator
19} from '../../../middlewares' 13} from '../../../middlewares'
20import { AccountModel } from '../../../models/account/account' 14import { AccountModel } from '../../../models/account/account'
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index 276948098..b11da2ef7 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -1,6 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model' 2import { VideoCommentCreate } from '../../../../shared/models/videos/video-comment.model'
3import { getFormattedObjects, retryTransactionWrapper } from '../../../helpers' 3import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { getFormattedObjects } from '../../../helpers/utils'
4import { sequelizeTypescript } from '../../../initializers' 5import { sequelizeTypescript } from '../../../initializers'
5import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment' 6import { buildFormattedCommentTree, createVideoComment } from '../../../lib/video-comment'
6import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares' 7import { asyncMiddleware, authenticate, paginationValidator, setPagination, setVideoCommentThreadsSort } from '../../../middlewares'
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 8e54d95ab..11e3da5cc 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -2,44 +2,21 @@ import * as express from 'express'
2import * as multer from 'multer' 2import * as multer from 'multer'
3import { extname, join } from 'path' 3import { extname, join } from 'path'
4import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared' 4import { VideoCreate, VideoPrivacy, VideoUpdate } from '../../../../shared'
5import { renamePromise } from '../../../helpers/core-utils'
6import { retryTransactionWrapper } from '../../../helpers/database-utils'
7import { getVideoFileHeight } from '../../../helpers/ffmpeg-utils'
8import { logger } from '../../../helpers/logger'
9import { generateRandomString, getFormattedObjects, getServerActor, resetSequelizeInstance } from '../../../helpers/utils'
5import { 10import {
6 generateRandomString, 11 CONFIG, sequelizeTypescript, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_MIMETYPE_EXT,
7 getFormattedObjects,
8 getVideoFileHeight,
9 logger,
10 renamePromise,
11 resetSequelizeInstance,
12 retryTransactionWrapper
13} from '../../../helpers'
14import { getServerActor } from '../../../helpers/utils'
15import {
16 CONFIG,
17 sequelizeTypescript,
18 VIDEO_CATEGORIES,
19 VIDEO_LANGUAGES,
20 VIDEO_LICENCES,
21 VIDEO_MIMETYPE_EXT,
22 VIDEO_PRIVACIES 12 VIDEO_PRIVACIES
23} from '../../../initializers' 13} from '../../../initializers'
24import { 14import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub'
25 fetchRemoteVideoDescription,
26 getVideoActivityPubUrl,
27 shareVideoByServerAndChannel
28} from '../../../lib/activitypub'
29import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send' 15import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send'
30import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler' 16import { transcodingJobScheduler } from '../../../lib/jobs/transcoding-job-scheduler'
31import { 17import {
32 asyncMiddleware, 18 asyncMiddleware, authenticate, paginationValidator, setPagination, setVideosSort, videosAddValidator, videosGetValidator,
33 authenticate, 19 videosRemoveValidator, videosSearchValidator, videosSortValidator, videosUpdateValidator
34 paginationValidator,
35 setPagination,
36 setVideosSort,
37 videosAddValidator,
38 videosGetValidator,
39 videosRemoveValidator,
40 videosSearchValidator,
41 videosSortValidator,
42 videosUpdateValidator
43} from '../../../middlewares' 20} from '../../../middlewares'
44import { TagModel } from '../../../models/video/tag' 21import { TagModel } from '../../../models/video/tag'
45import { VideoModel } from '../../../models/video/video' 22import { VideoModel } from '../../../models/video/video'
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 48b744b0c..b470f27f6 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,6 +1,7 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserVideoRateUpdate } from '../../../../shared' 2import { UserVideoRateUpdate } from '../../../../shared'
3import { logger, retryTransactionWrapper } from '../../../helpers' 3import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { logger } from '../../../helpers/logger'
4import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers' 5import { sequelizeTypescript, VIDEO_RATE_TYPES } from '../../../initializers'
5import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub' 6import { sendVideoRateChangeToFollowers, sendVideoRateChangeToOrigin } from '../../../lib/activitypub'
6import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares' 7import { asyncMiddleware, authenticate, videoRateValidator } from '../../../middlewares'