aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-22 11:27:40 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commitc46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (patch)
tree073e32adb1bf93a597a269432e33a8f28365deb5 /server/controllers
parentc986175d68a18e96fbd41537a05c7796a2c64f38 (diff)
downloadPeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.tar.gz
PeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.tar.zst
PeerTube-c46edbc2f6ca310b2f0331f979ac6caf27f6eb92.zip
Fetch outbox to grab old activities tests
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/activitypub/client.ts4
-rw-r--r--server/controllers/activitypub/outbox.ts2
-rw-r--r--server/controllers/api/server/follows.ts13
3 files changed, 8 insertions, 11 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 24c8665a5..eee89e2fd 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -56,7 +56,7 @@ async function accountController (req: express.Request, res: express.Response, n
56async function accountFollowersController (req: express.Request, res: express.Response, next: express.NextFunction) { 56async function accountFollowersController (req: express.Request, res: express.Response, next: express.NextFunction) {
57 const account: AccountInstance = res.locals.account 57 const account: AccountInstance = res.locals.account
58 58
59 const page = req.params.page || 1 59 const page = req.query.page || 1
60 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) 60 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
61 61
62 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], start, count) 62 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], start, count)
@@ -68,7 +68,7 @@ async function accountFollowersController (req: express.Request, res: express.Re
68async function accountFollowingController (req: express.Request, res: express.Response, next: express.NextFunction) { 68async function accountFollowingController (req: express.Request, res: express.Response, next: express.NextFunction) {
69 const account: AccountInstance = res.locals.account 69 const account: AccountInstance = res.locals.account
70 70
71 const page = req.params.page || 1 71 const page = req.query.page || 1
72 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) 72 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
73 73
74 const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], start, count) 74 const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], start, count)
diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts
index 1a74bde33..74d399763 100644
--- a/server/controllers/activitypub/outbox.ts
+++ b/server/controllers/activitypub/outbox.ts
@@ -28,7 +28,7 @@ export {
28async function outboxController (req: express.Request, res: express.Response, next: express.NextFunction) { 28async function outboxController (req: express.Request, res: express.Response, next: express.NextFunction) {
29 const account: AccountInstance = res.locals.account 29 const account: AccountInstance = res.locals.account
30 30
31 const page = req.params.page || 1 31 const page = req.query.page || 1
32 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) 32 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
33 33
34 const data = await db.Video.listAllAndSharedByAccountForOutbox(account.id, start, count) 34 const data = await db.Video.listAllAndSharedByAccountForOutbox(account.id, start, count)
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index 4b54afc8d..391f8bdca 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -1,11 +1,15 @@
1import * as express from 'express' 1import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users/user-right.enum' 2import { UserRight } from '../../../../shared/models/users/user-right.enum'
3import { getFormattedObjects } from '../../../helpers' 3import { getFormattedObjects } from '../../../helpers'
4import { retryTransactionWrapper } from '../../../helpers/database-utils'
4import { logger } from '../../../helpers/logger' 5import { logger } from '../../../helpers/logger'
5import { getServerAccount } from '../../../helpers/utils' 6import { getServerAccount } from '../../../helpers/utils'
6import { getAccountFromWebfinger } from '../../../helpers/webfinger' 7import { getAccountFromWebfinger } from '../../../helpers/webfinger'
7import { SERVER_ACCOUNT_NAME } from '../../../initializers/constants' 8import { SERVER_ACCOUNT_NAME } from '../../../initializers/constants'
8import { database as db } from '../../../initializers/database' 9import { database as db } from '../../../initializers/database'
10import { saveAccountAndServerIfNotExist } from '../../../lib/activitypub/account'
11import { sendUndoFollow } from '../../../lib/activitypub/send/send-undo'
12import { sendFollow } from '../../../lib/index'
9import { asyncMiddleware, paginationValidator, removeFollowingValidator, setFollowersSort, setPagination } from '../../../middlewares' 13import { asyncMiddleware, paginationValidator, removeFollowingValidator, setFollowersSort, setPagination } from '../../../middlewares'
10import { authenticate } from '../../../middlewares/oauth' 14import { authenticate } from '../../../middlewares/oauth'
11import { setBodyHostsPort } from '../../../middlewares/servers' 15import { setBodyHostsPort } from '../../../middlewares/servers'
@@ -13,13 +17,8 @@ import { setFollowingSort } from '../../../middlewares/sort'
13import { ensureUserHasRight } from '../../../middlewares/user-right' 17import { ensureUserHasRight } from '../../../middlewares/user-right'
14import { followValidator } from '../../../middlewares/validators/follows' 18import { followValidator } from '../../../middlewares/validators/follows'
15import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' 19import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort'
16import { AccountFollowInstance } from '../../../models/index'
17import { sendFollow } from '../../../lib/index'
18import { sendUndoFollow } from '../../../lib/activitypub/send/send-undo'
19import { AccountInstance } from '../../../models/account/account-interface' 20import { AccountInstance } from '../../../models/account/account-interface'
20import { retryTransactionWrapper } from '../../../helpers/database-utils' 21import { AccountFollowInstance } from '../../../models/index'
21import { saveAccountAndServerIfNotExist } from '../../../lib/activitypub/account'
22import { addFetchOutboxJob } from '../../../lib/activitypub/fetch'
23 22
24const serverFollowsRouter = express.Router() 23const serverFollowsRouter = express.Router()
25 24
@@ -137,8 +136,6 @@ async function follow (fromAccount: AccountInstance, targetAccount: AccountInsta
137 if (accountFollow.state === 'pending') { 136 if (accountFollow.state === 'pending') {
138 await sendFollow(accountFollow, t) 137 await sendFollow(accountFollow, t)
139 } 138 }
140
141 await addFetchOutboxJob(targetAccount, t)
142 }) 139 })
143 } catch (err) { 140 } catch (err) {
144 // Reset target account 141 // Reset target account