aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-29 11:59:29 +0200
committerChocobozzz <me@florianbigard.com>2019-07-29 13:40:39 +0200
commit2284f202070aa2e49156cc52b3b1596a7d5aadec (patch)
tree77aeb00016734667f8ff32a98ea8b4a6ed3ca31e /server
parent112be80ebdf96ef6a27420c1c6a10097388731a9 (diff)
downloadPeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.gz
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.zst
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.zip
Add gitlab ci support
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/videos/abuse.ts6
-rw-r--r--server/helpers/database-utils.ts10
-rw-r--r--server/lib/activitypub/process/process-flag.ts8
-rw-r--r--server/lib/activitypub/send/send-create.ts5
-rw-r--r--server/lib/activitypub/send/send-delete.ts4
-rw-r--r--server/lib/activitypub/send/send-flag.ts5
-rw-r--r--server/lib/activitypub/send/send-follow.ts5
-rw-r--r--server/lib/activitypub/send/send-undo.ts2
-rw-r--r--server/lib/activitypub/send/send-update.ts4
-rw-r--r--server/lib/activitypub/send/utils.ts20
-rw-r--r--server/lib/job-queue/handlers/activitypub-follow.ts2
-rw-r--r--server/tests/api/activitypub/fetch.ts2
-rw-r--r--server/tests/api/ci-1.sh (renamed from server/tests/api/travis-1.sh)2
-rw-r--r--server/tests/api/ci-2.sh (renamed from server/tests/api/travis-2.sh)2
-rw-r--r--server/tests/api/ci-3.sh (renamed from server/tests/api/travis-3.sh)2
-rw-r--r--server/tests/api/ci-4.sh (renamed from server/tests/api/travis-4.sh)2
-rw-r--r--server/tests/api/notifications/user-notifications.ts4
-rw-r--r--server/tests/api/server/email.ts2
-rw-r--r--server/tests/api/server/handle-down.ts2
-rw-r--r--server/tests/api/server/jobs.ts3
-rw-r--r--server/tests/api/videos/video-schedule-update.ts2
21 files changed, 58 insertions, 36 deletions
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index ca70230a2..77808466c 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -113,16 +113,16 @@ async function reportVideoAbuse (req: express.Request, res: express.Response) {
113 113
114 // We send the video abuse to the origin server 114 // We send the video abuse to the origin server
115 if (videoInstance.isOwned() === false) { 115 if (videoInstance.isOwned() === false) {
116 await sendVideoAbuse(reporterAccount.Actor, videoAbuseInstance, videoInstance) 116 await sendVideoAbuse(reporterAccount.Actor, videoAbuseInstance, videoInstance, t)
117 } 117 }
118 118
119 Notifier.Instance.notifyOnNewVideoAbuse(videoAbuseInstance)
120
121 auditLogger.create(reporterAccount.Actor.getIdentifier(), new VideoAbuseAuditView(videoAbuseInstance.toFormattedJSON())) 119 auditLogger.create(reporterAccount.Actor.getIdentifier(), new VideoAbuseAuditView(videoAbuseInstance.toFormattedJSON()))
122 120
123 return videoAbuseInstance 121 return videoAbuseInstance
124 }) 122 })
125 123
124 Notifier.Instance.notifyOnNewVideoAbuse(videoAbuse)
125
126 logger.info('Abuse report for video %s created.', videoInstance.name) 126 logger.info('Abuse report for video %s created.', videoInstance.name)
127 127
128 return res.json({ videoAbuse: videoAbuse.toFormattedJSON() }).end() 128 return res.json({ videoAbuse: videoAbuse.toFormattedJSON() }).end()
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index 39c74b2fd..6c5068fb0 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -2,6 +2,7 @@ import * as retry from 'async/retry'
2import * as Bluebird from 'bluebird' 2import * as Bluebird from 'bluebird'
3import { Model } from 'sequelize-typescript' 3import { Model } from 'sequelize-typescript'
4import { logger } from './logger' 4import { logger } from './logger'
5import { Transaction } from 'sequelize'
5 6
6function retryTransactionWrapper <T, A, B, C> ( 7function retryTransactionWrapper <T, A, B, C> (
7 functionToRetry: (arg1: A, arg2: B, arg3: C) => Promise<T> | Bluebird<T>, 8 functionToRetry: (arg1: A, arg2: B, arg3: C) => Promise<T> | Bluebird<T>,
@@ -72,11 +73,18 @@ function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
72 }) 73 })
73} 74}
74 75
76function afterCommitIfTransaction (t: Transaction, fn: Function) {
77 if (t) return t.afterCommit(() => fn())
78
79 return fn()
80}
81
75// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
76 83
77export { 84export {
78 resetSequelizeInstance, 85 resetSequelizeInstance,
79 retryTransactionWrapper, 86 retryTransactionWrapper,
80 transactionRetryer, 87 transactionRetryer,
81 updateInstanceWithAnother 88 updateInstanceWithAnother,
89 afterCommitIfTransaction
82} 90}
diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts
index 0b3976089..8faab051e 100644
--- a/server/lib/activitypub/process/process-flag.ts
+++ b/server/lib/activitypub/process/process-flag.ts
@@ -31,7 +31,7 @@ async function processCreateVideoAbuse (activity: ActivityCreate | ActivityFlag,
31 31
32 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: flag.object }) 32 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: flag.object })
33 33
34 return sequelizeTypescript.transaction(async t => { 34 const videoAbuse = await sequelizeTypescript.transaction(async t => {
35 const videoAbuseData = { 35 const videoAbuseData = {
36 reporterAccountId: account.id, 36 reporterAccountId: account.id,
37 reason: flag.content, 37 reason: flag.content,
@@ -42,8 +42,10 @@ async function processCreateVideoAbuse (activity: ActivityCreate | ActivityFlag,
42 const videoAbuseInstance = await VideoAbuseModel.create(videoAbuseData, { transaction: t }) 42 const videoAbuseInstance = await VideoAbuseModel.create(videoAbuseData, { transaction: t })
43 videoAbuseInstance.Video = video 43 videoAbuseInstance.Video = video
44 44
45 Notifier.Instance.notifyOnNewVideoAbuse(videoAbuseInstance)
46
47 logger.info('Remote abuse for video uuid %s created', flag.object) 45 logger.info('Remote abuse for video uuid %s created', flag.object)
46
47 return videoAbuseInstance
48 }) 48 })
49
50 Notifier.Instance.notifyOnNewVideoAbuse(videoAbuse)
49} 51}
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index 28f18595b..9c21149f2 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -11,6 +11,7 @@ import { VideoRedundancyModel } from '../../../models/redundancy/video-redundanc
11import { VideoPlaylistModel } from '../../../models/video/video-playlist' 11import { VideoPlaylistModel } from '../../../models/video/video-playlist'
12import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' 12import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model'
13import { getServerActor } from '../../../helpers/utils' 13import { getServerActor } from '../../../helpers/utils'
14import * as Bluebird from 'bluebird'
14 15
15async function sendCreateVideo (video: VideoModel, t: Transaction) { 16async function sendCreateVideo (video: VideoModel, t: Transaction) {
16 if (video.privacy === VideoPrivacy.PRIVATE) return undefined 17 if (video.privacy === VideoPrivacy.PRIVATE) return undefined
@@ -82,7 +83,7 @@ async function sendCreateVideoComment (comment: VideoCommentModel, t: Transactio
82 83
83 // This was a reply, send it to the parent actors 84 // This was a reply, send it to the parent actors
84 const actorsException = [ byActor ] 85 const actorsException = [ byActor ]
85 await broadcastToActors(createActivity, byActor, parentsCommentActors, actorsException) 86 await broadcastToActors(createActivity, byActor, parentsCommentActors, t, actorsException)
86 87
87 // Broadcast to our followers 88 // Broadcast to our followers
88 await broadcastToFollowers(createActivity, byActor, [ byActor ], t) 89 await broadcastToFollowers(createActivity, byActor, [ byActor ], t)
@@ -91,7 +92,7 @@ async function sendCreateVideoComment (comment: VideoCommentModel, t: Transactio
91 if (isOrigin) return broadcastToFollowers(createActivity, byActor, actorsInvolvedInComment, t, actorsException) 92 if (isOrigin) return broadcastToFollowers(createActivity, byActor, actorsInvolvedInComment, t, actorsException)
92 93
93 // Send to origin 94 // Send to origin
94 return unicastTo(createActivity, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl) 95 t.afterCommit(() => unicastTo(createActivity, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl))
95} 96}
96 97
97function buildCreateActivity (url: string, byActor: ActorModel, object: any, audience?: ActivityAudience): ActivityCreate { 98function buildCreateActivity (url: string, byActor: ActorModel, object: any, audience?: ActivityAudience): ActivityCreate {
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index 7bf5ca520..7a1d6f0ba 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -59,7 +59,7 @@ async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Trans
59 59
60 // This was a reply, send it to the parent actors 60 // This was a reply, send it to the parent actors
61 const actorsException = [ byActor ] 61 const actorsException = [ byActor ]
62 await broadcastToActors(activity, byActor, threadParentComments.map(c => c.Account.Actor), actorsException) 62 await broadcastToActors(activity, byActor, threadParentComments.map(c => c.Account.Actor), t, actorsException)
63 63
64 // Broadcast to our followers 64 // Broadcast to our followers
65 await broadcastToFollowers(activity, byActor, [ byActor ], t) 65 await broadcastToFollowers(activity, byActor, [ byActor ], t)
@@ -68,7 +68,7 @@ async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Trans
68 if (isVideoOrigin) return broadcastToFollowers(activity, byActor, actorsInvolvedInComment, t, actorsException) 68 if (isVideoOrigin) return broadcastToFollowers(activity, byActor, actorsInvolvedInComment, t, actorsException)
69 69
70 // Send to origin 70 // Send to origin
71 return unicastTo(activity, byActor, videoComment.Video.VideoChannel.Account.Actor.sharedInboxUrl) 71 t.afterCommit(() => unicastTo(activity, byActor, videoComment.Video.VideoChannel.Account.Actor.sharedInboxUrl))
72} 72}
73 73
74async function sendDeleteVideoPlaylist (videoPlaylist: VideoPlaylistModel, t: Transaction) { 74async function sendDeleteVideoPlaylist (videoPlaylist: VideoPlaylistModel, t: Transaction) {
diff --git a/server/lib/activitypub/send/send-flag.ts b/server/lib/activitypub/send/send-flag.ts
index 96a7311b9..61ee389a6 100644
--- a/server/lib/activitypub/send/send-flag.ts
+++ b/server/lib/activitypub/send/send-flag.ts
@@ -6,8 +6,9 @@ import { unicastTo } from './utils'
6import { logger } from '../../../helpers/logger' 6import { logger } from '../../../helpers/logger'
7import { ActivityAudience, ActivityFlag } from '../../../../shared/models/activitypub' 7import { ActivityAudience, ActivityFlag } from '../../../../shared/models/activitypub'
8import { audiencify, getAudience } from '../audience' 8import { audiencify, getAudience } from '../audience'
9import { Transaction } from 'sequelize'
9 10
10async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel) { 11async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) {
11 if (!video.VideoChannel.Account.Actor.serverId) return // Local user 12 if (!video.VideoChannel.Account.Actor.serverId) return // Local user
12 13
13 const url = getVideoAbuseActivityPubUrl(videoAbuse) 14 const url = getVideoAbuseActivityPubUrl(videoAbuse)
@@ -18,7 +19,7 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel,
18 const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } 19 const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] }
19 const flagActivity = buildFlagActivity(url, byActor, videoAbuse, audience) 20 const flagActivity = buildFlagActivity(url, byActor, videoAbuse, audience)
20 21
21 return unicastTo(flagActivity, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) 22 t.afterCommit(() => unicastTo(flagActivity, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl))
22} 23}
23 24
24function buildFlagActivity (url: string, byActor: ActorModel, videoAbuse: VideoAbuseModel, audience: ActivityAudience): ActivityFlag { 25function buildFlagActivity (url: string, byActor: ActorModel, videoAbuse: VideoAbuseModel, audience: ActivityAudience): ActivityFlag {
diff --git a/server/lib/activitypub/send/send-follow.ts b/server/lib/activitypub/send/send-follow.ts
index 2c3d02014..c6e7fe83d 100644
--- a/server/lib/activitypub/send/send-follow.ts
+++ b/server/lib/activitypub/send/send-follow.ts
@@ -4,8 +4,9 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
4import { getActorFollowActivityPubUrl } from '../url' 4import { getActorFollowActivityPubUrl } from '../url'
5import { unicastTo } from './utils' 5import { unicastTo } from './utils'
6import { logger } from '../../../helpers/logger' 6import { logger } from '../../../helpers/logger'
7import { Transaction } from 'sequelize'
7 8
8function sendFollow (actorFollow: ActorFollowModel) { 9function sendFollow (actorFollow: ActorFollowModel, t: Transaction) {
9 const me = actorFollow.ActorFollower 10 const me = actorFollow.ActorFollower
10 const following = actorFollow.ActorFollowing 11 const following = actorFollow.ActorFollowing
11 12
@@ -17,7 +18,7 @@ function sendFollow (actorFollow: ActorFollowModel) {
17 const url = getActorFollowActivityPubUrl(me, following) 18 const url = getActorFollowActivityPubUrl(me, following)
18 const data = buildFollowActivity(url, me, following) 19 const data = buildFollowActivity(url, me, following)
19 20
20 return unicastTo(data, me, following.inboxUrl) 21 t.afterCommit(() => unicastTo(data, me, following.inboxUrl))
21} 22}
22 23
23function buildFollowActivity (url: string, byActor: ActorModel, targetActor: ActorModel): ActivityFollow { 24function buildFollowActivity (url: string, byActor: ActorModel, targetActor: ActorModel): ActivityFollow {
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts
index 8727a121e..8fcbbac5c 100644
--- a/server/lib/activitypub/send/send-undo.ts
+++ b/server/lib/activitypub/send/send-undo.ts
@@ -37,7 +37,7 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) {
37 const followActivity = buildFollowActivity(followUrl, me, following) 37 const followActivity = buildFollowActivity(followUrl, me, following)
38 const undoActivity = undoActivityData(undoUrl, me, followActivity) 38 const undoActivity = undoActivityData(undoUrl, me, followActivity)
39 39
40 return unicastTo(undoActivity, me, following.inboxUrl) 40 t.afterCommit(() => unicastTo(undoActivity, me, following.inboxUrl))
41} 41}
42 42
43async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { 43async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) {
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index 7411c08d5..5bf092894 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -26,7 +26,9 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction, overrodeByAct
26 const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) 26 const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString())
27 27
28 // Needed to build the AP object 28 // Needed to build the AP object
29 if (!video.VideoCaptions) video.VideoCaptions = await video.$get('VideoCaptions') as VideoCaptionModel[] 29 if (!video.VideoCaptions) {
30 video.VideoCaptions = await video.$get('VideoCaptions', { transaction: t }) as VideoCaptionModel[]
31 }
30 32
31 const videoObject = video.toActivityPubObject() 33 const videoObject = video.toActivityPubObject()
32 const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC) 34 const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC)
diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts
index 69706e620..1faae1d84 100644
--- a/server/lib/activitypub/send/utils.ts
+++ b/server/lib/activitypub/send/utils.ts
@@ -7,6 +7,7 @@ import { JobQueue } from '../../job-queue'
7import { VideoModel } from '../../../models/video/video' 7import { VideoModel } from '../../../models/video/video'
8import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience' 8import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience'
9import { getServerActor } from '../../../helpers/utils' 9import { getServerActor } from '../../../helpers/utils'
10import { afterCommitIfTransaction } from '../../../helpers/database-utils'
10 11
11async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: { 12async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: {
12 byActor: ActorModel, 13 byActor: ActorModel,
@@ -20,7 +21,9 @@ async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAud
20 const audience = getRemoteVideoAudience(options.video, actorsInvolvedInVideo) 21 const audience = getRemoteVideoAudience(options.video, actorsInvolvedInVideo)
21 const activity = activityBuilder(audience) 22 const activity = activityBuilder(audience)
22 23
23 return unicastTo(activity, options.byActor, options.video.VideoChannel.Account.Actor.sharedInboxUrl) 24 return afterCommitIfTransaction(options.transaction, () => {
25 return unicastTo(activity, options.byActor, options.video.VideoChannel.Account.Actor.sharedInboxUrl)
26 })
24 } 27 }
25 28
26 // Send to followers 29 // Send to followers
@@ -28,6 +31,7 @@ async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAud
28 const activity = activityBuilder(audience) 31 const activity = activityBuilder(audience)
29 32
30 const actorsException = [ options.byActor ] 33 const actorsException = [ options.byActor ]
34
31 return broadcastToFollowers(activity, options.byActor, actorsInvolvedInVideo, options.transaction, actorsException) 35 return broadcastToFollowers(activity, options.byActor, actorsInvolvedInVideo, options.transaction, actorsException)
32} 36}
33 37
@@ -76,7 +80,7 @@ async function forwardActivity (
76 uris, 80 uris,
77 body: activity 81 body: activity
78 } 82 }
79 return JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload }) 83 return afterCommitIfTransaction(t, () => JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload }))
80} 84}
81 85
82async function broadcastToFollowers ( 86async function broadcastToFollowers (
@@ -87,20 +91,22 @@ async function broadcastToFollowers (
87 actorsException: ActorModel[] = [] 91 actorsException: ActorModel[] = []
88) { 92) {
89 const uris = await computeFollowerUris(toFollowersOf, actorsException, t) 93 const uris = await computeFollowerUris(toFollowersOf, actorsException, t)
90 return broadcastTo(uris, data, byActor) 94
95 return afterCommitIfTransaction(t, () => broadcastTo(uris, data, byActor))
91} 96}
92 97
93async function broadcastToActors ( 98async function broadcastToActors (
94 data: any, 99 data: any,
95 byActor: ActorModel, 100 byActor: ActorModel,
96 toActors: ActorModel[], 101 toActors: ActorModel[],
102 t?: Transaction,
97 actorsException: ActorModel[] = [] 103 actorsException: ActorModel[] = []
98) { 104) {
99 const uris = await computeUris(toActors, actorsException) 105 const uris = await computeUris(toActors, actorsException)
100 return broadcastTo(uris, data, byActor) 106 return afterCommitIfTransaction(t, () => broadcastTo(uris, data, byActor))
101} 107}
102 108
103async function broadcastTo (uris: string[], data: any, byActor: ActorModel) { 109function broadcastTo (uris: string[], data: any, byActor: ActorModel) {
104 if (uris.length === 0) return undefined 110 if (uris.length === 0) return undefined
105 111
106 logger.debug('Creating broadcast job.', { uris }) 112 logger.debug('Creating broadcast job.', { uris })
@@ -114,7 +120,7 @@ async function broadcastTo (uris: string[], data: any, byActor: ActorModel) {
114 return JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload }) 120 return JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload })
115} 121}
116 122
117async function unicastTo (data: any, byActor: ActorModel, toActorUrl: string) { 123function unicastTo (data: any, byActor: ActorModel, toActorUrl: string) {
118 logger.debug('Creating unicast job.', { uri: toActorUrl }) 124 logger.debug('Creating unicast job.', { uri: toActorUrl })
119 125
120 const payload = { 126 const payload = {
@@ -123,7 +129,7 @@ async function unicastTo (data: any, byActor: ActorModel, toActorUrl: string) {
123 body: data 129 body: data
124 } 130 }
125 131
126 return JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload }) 132 JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload })
127} 133}
128 134
129// --------------------------------------------------------------------------- 135// ---------------------------------------------------------------------------
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts
index b3defb617..4ae66cd01 100644
--- a/server/lib/job-queue/handlers/activitypub-follow.ts
+++ b/server/lib/job-queue/handlers/activitypub-follow.ts
@@ -69,7 +69,7 @@ async function follow (fromActor: ActorModel, targetActor: ActorModel) {
69 actorFollow.ActorFollower = fromActor 69 actorFollow.ActorFollower = fromActor
70 70
71 // Send a notification to remote server if our follow is not already accepted 71 // Send a notification to remote server if our follow is not already accepted
72 if (actorFollow.state !== 'accepted') await sendFollow(actorFollow) 72 if (actorFollow.state !== 'accepted') sendFollow(actorFollow, t)
73 73
74 return actorFollow 74 return actorFollow
75 }) 75 })
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index 3a1c0d321..3d54c2042 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -87,7 +87,7 @@ describe('Test ActivityPub fetcher', function () {
87 }) 87 })
88 88
89 after(async function () { 89 after(async function () {
90 this.timeout(10000) 90 this.timeout(20000)
91 91
92 await cleanupTests(servers) 92 await cleanupTests(servers)
93 93
diff --git a/server/tests/api/travis-1.sh b/server/tests/api/ci-1.sh
index db4021b25..8dd9756a5 100644
--- a/server/tests/api/travis-1.sh
+++ b/server/tests/api/ci-1.sh
@@ -6,5 +6,5 @@ checkParamFiles=$(find server/tests/api/check-params -type f | grep -v index.ts
6notificationsFiles=$(find server/tests/api/notifications -type f | grep -v index.ts | xargs echo) 6notificationsFiles=$(find server/tests/api/notifications -type f | grep -v index.ts | xargs echo)
7searchFiles=$(find server/tests/api/search -type f | grep -v index.ts | xargs echo) 7searchFiles=$(find server/tests/api/search -type f | grep -v index.ts | xargs echo)
8 8
9MOCHA_PARALLEL=true mocha --timeout 5000 --exit --require ts-node/register --bail \ 9MOCHA_PARALLEL=true npm run mocha --timeout 30000 --exit --require ts-node/register --bail \
10 $notificationsFiles $searchFiles $checkParamFiles 10 $notificationsFiles $searchFiles $checkParamFiles
diff --git a/server/tests/api/travis-2.sh b/server/tests/api/ci-2.sh
index ba7a061b0..16ab585e9 100644
--- a/server/tests/api/travis-2.sh
+++ b/server/tests/api/ci-2.sh
@@ -5,5 +5,5 @@ set -eu
5serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo) 5serverFiles=$(find server/tests/api/server -type f | grep -v index.ts | xargs echo)
6usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo) 6usersFiles=$(find server/tests/api/users -type f | grep -v index.ts | xargs echo)
7 7
8MOCHA_PARALLEL=true mocha --timeout 5000 --exit --require ts-node/register --bail \ 8MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit --require ts-node/register --bail \
9 $serverFiles $usersFiles 9 $serverFiles $usersFiles
diff --git a/server/tests/api/travis-3.sh b/server/tests/api/ci-3.sh
index 82457222c..fc96f6fb4 100644
--- a/server/tests/api/travis-3.sh
+++ b/server/tests/api/ci-3.sh
@@ -4,5 +4,5 @@ set -eu
4 4
5videosFiles=$(find server/tests/api/videos -type f | grep -v index.ts | xargs echo) 5videosFiles=$(find server/tests/api/videos -type f | grep -v index.ts | xargs echo)
6 6
7MOCHA_PARALLEL=true mocha --timeout 5000 --exit --require ts-node/register --bail \ 7MOCHA_PARALLEL=true npm run mocha --timeout 30000 --exit --require ts-node/register --bail \
8 $videosFiles 8 $videosFiles
diff --git a/server/tests/api/travis-4.sh b/server/tests/api/ci-4.sh
index 875986182..74809e1ad 100644
--- a/server/tests/api/travis-4.sh
+++ b/server/tests/api/ci-4.sh
@@ -5,5 +5,5 @@ set -eu
5redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo) 5redundancyFiles=$(find server/tests/api/redundancy -type f | grep -v index.ts | xargs echo)
6activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo) 6activitypubFiles=$(find server/tests/api/activitypub -type f | grep -v index.ts | xargs echo)
7 7
8MOCHA_PARALLEL=true mocha-parallel-tests --max-parallel $1 --timeout 5000 --exit --require ts-node/register --bail \ 8MOCHA_PARALLEL=true npm run mocha-parallel-tests -- --max-parallel $1 --timeout 30000 --exit --require ts-node/register --bail \
9 $redundancyFiles $activitypubFiles 9 $redundancyFiles $activitypubFiles
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 662b64e05..6fa630562 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -782,7 +782,7 @@ describe('Test users notifications', function () {
782 it('Should not send a notification before the video is published', async function () { 782 it('Should not send a notification before the video is published', async function () {
783 this.timeout(20000) 783 this.timeout(20000)
784 784
785 let updateAt = new Date(new Date().getTime() + 100000) 785 let updateAt = new Date(new Date().getTime() + 1000000)
786 786
787 const data = { 787 const data = {
788 privacy: VideoPrivacy.PRIVATE, 788 privacy: VideoPrivacy.PRIVATE,
@@ -1074,7 +1074,7 @@ describe('Test users notifications', function () {
1074 it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () { 1074 it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () {
1075 this.timeout(20000) 1075 this.timeout(20000)
1076 1076
1077 let updateAt = new Date(new Date().getTime() + 100000) 1077 let updateAt = new Date(new Date().getTime() + 1000000)
1078 1078
1079 const name = 'video with auto-blacklist and future schedule ' + uuidv4() 1079 const name = 'video with auto-blacklist and future schedule ' + uuidv4()
1080 1080
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 7b7acfd12..c55a221f2 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -40,7 +40,7 @@ describe('Test emails', function () {
40 let emailPort: number 40 let emailPort: number
41 41
42 before(async function () { 42 before(async function () {
43 this.timeout(30000) 43 this.timeout(50000)
44 44
45 emailPort = await MockSmtpServer.Instance.collectEmails(emails) 45 emailPort = await MockSmtpServer.Instance.collectEmails(emails)
46 46
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 068654d8c..a225443c5 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -109,7 +109,7 @@ describe('Test handle downs', function () {
109 }) 109 })
110 110
111 it('Should remove followers that are often down', async function () { 111 it('Should remove followers that are often down', async function () {
112 this.timeout(60000) 112 this.timeout(240000)
113 113
114 // Server 2 and 3 follow server 1 114 // Server 2 and 3 follow server 1
115 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken) 115 await follow(servers[1].url, [ servers[0].url ], servers[1].accessToken)
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 3ab2fe120..ceea47a85 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -8,6 +8,7 @@ import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../../..
8import { flushAndRunMultipleServers } from '../../../../shared/extra-utils/server/servers' 8import { flushAndRunMultipleServers } from '../../../../shared/extra-utils/server/servers'
9import { uploadVideo } from '../../../../shared/extra-utils/videos/videos' 9import { uploadVideo } from '../../../../shared/extra-utils/videos/videos'
10import { dateIsValid } from '../../../../shared/extra-utils/miscs/miscs' 10import { dateIsValid } from '../../../../shared/extra-utils/miscs/miscs'
11import { Job } from '../../../../shared/models/server'
11 12
12const expect = chai.expect 13const expect = chai.expect
13 14
@@ -50,7 +51,7 @@ describe('Test jobs', function () {
50 if (job.type === 'videos-views') job = res.body.data[1] 51 if (job.type === 'videos-views') job = res.body.data[1]
51 52
52 expect(job.state).to.equal('completed') 53 expect(job.state).to.equal('completed')
53 expect(job.type).to.equal('activitypub-follow') 54 expect(job.type.startsWith('activitypub-')).to.be.true
54 expect(dateIsValid(job.createdAt)).to.be.true 55 expect(dateIsValid(job.createdAt)).to.be.true
55 expect(dateIsValid(job.processedOn)).to.be.true 56 expect(dateIsValid(job.processedOn)).to.be.true
56 expect(dateIsValid(job.finishedOn)).to.be.true 57 expect(dateIsValid(job.finishedOn)).to.be.true
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 64f657780..65a8eafb8 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -85,7 +85,7 @@ describe('Test video update scheduler', function () {
85 }) 85 })
86 86
87 it('Should wait some seconds and have the video in public privacy', async function () { 87 it('Should wait some seconds and have the video in public privacy', async function () {
88 this.timeout(20000) 88 this.timeout(50000)
89 89
90 await wait(15000) 90 await wait(15000)
91 await waitJobs(servers) 91 await waitJobs(servers)