aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/migrations/0080-video-channels.ts2
-rw-r--r--server/models/account/account.ts3
-rw-r--r--server/models/account/user.ts2
-rw-r--r--server/models/activitypub/actor.ts2
-rw-r--r--server/models/video/video-change-ownership.ts2
-rw-r--r--server/models/video/video-channel.ts6
-rw-r--r--server/models/video/video-file.ts2
-rw-r--r--server/models/video/video-import.ts2
-rw-r--r--server/models/video/video-streaming-playlist.ts2
-rw-r--r--server/models/video/video.ts2
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts2
-rw-r--r--server/tests/api/server/email.ts3
-rw-r--r--server/tests/api/server/follows.ts2
13 files changed, 16 insertions, 16 deletions
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts
index f19721517..0e17a4ccd 100644
--- a/server/initializers/migrations/0080-video-channels.ts
+++ b/server/initializers/migrations/0080-video-channels.ts
@@ -74,7 +74,7 @@ async function up (utils: {
74 for (const rawVideo of rawVideos) { 74 for (const rawVideo of rawVideos) {
75 const videoChannel = await utils.db.VideoChannel.findOne({ where: { authorId: rawVideo.authorId } }) 75 const videoChannel = await utils.db.VideoChannel.findOne({ where: { authorId: rawVideo.authorId } })
76 76
77 const video = await utils.db.Video.findById(rawVideo.id) 77 const video = await utils.db.Video.findByPk(rawVideo.id)
78 video.channelId = videoChannel.id 78 video.channelId = videoChannel.id
79 await video.save() 79 await video.save()
80 } 80 }
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 747b51afb..ee22d8528 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -24,7 +24,6 @@ import { getSort, throwIfNotValid } from '../utils'
24import { VideoChannelModel } from '../video/video-channel' 24import { VideoChannelModel } from '../video/video-channel'
25import { VideoCommentModel } from '../video/video-comment' 25import { VideoCommentModel } from '../video/video-comment'
26import { UserModel } from './user' 26import { UserModel } from './user'
27import * as Bluebird from '../../helpers/custom-validators/accounts'
28import { CONFIG } from '../../initializers' 27import { CONFIG } from '../../initializers'
29 28
30@DefaultScope({ 29@DefaultScope({
@@ -136,7 +135,7 @@ export class AccountModel extends Model<AccountModel> {
136 } 135 }
137 136
138 static load (id: number, transaction?: Sequelize.Transaction) { 137 static load (id: number, transaction?: Sequelize.Transaction) {
139 return AccountModel.findById(id, { transaction }) 138 return AccountModel.findByPk(id, { transaction })
140 } 139 }
141 140
142 static loadByUUID (uuid: string) { 141 static loadByUUID (uuid: string) {
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 017a96657..8aff9f497 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -341,7 +341,7 @@ export class UserModel extends Model<UserModel> {
341 } 341 }
342 342
343 static loadById (id: number) { 343 static loadById (id: number) {
344 return UserModel.findById(id) 344 return UserModel.findByPk(id)
345 } 345 }
346 346
347 static loadByUsername (username: string) { 347 static loadByUsername (username: string) {
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index dda57a8ba..49f82023b 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -265,7 +265,7 @@ export class ActorModel extends Model<ActorModel> {
265 VideoChannel: VideoChannelModel 265 VideoChannel: VideoChannelModel
266 266
267 static load (id: number) { 267 static load (id: number) {
268 return ActorModel.unscoped().findById(id) 268 return ActorModel.unscoped().findByPk(id)
269 } 269 }
270 270
271 static loadAccountActorByVideoId (videoId: number, transaction: Sequelize.Transaction) { 271 static loadAccountActorByVideoId (videoId: number, transaction: Sequelize.Transaction) {
diff --git a/server/models/video/video-change-ownership.ts b/server/models/video/video-change-ownership.ts
index 48c07728f..85e688c4f 100644
--- a/server/models/video/video-change-ownership.ts
+++ b/server/models/video/video-change-ownership.ts
@@ -110,7 +110,7 @@ export class VideoChangeOwnershipModel extends Model<VideoChangeOwnershipModel>
110 } 110 }
111 111
112 static load (id: number) { 112 static load (id: number) {
113 return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findById(id) 113 return VideoChangeOwnershipModel.scope(ScopeNames.FULL).findByPk(id)
114 } 114 }
115 115
116 toFormattedJSON (): VideoChangeOwnership { 116 toFormattedJSON (): VideoChangeOwnership {
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 91dd0440c..2426b3de6 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -320,7 +320,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
320 static loadByIdAndPopulateAccount (id: number) { 320 static loadByIdAndPopulateAccount (id: number) {
321 return VideoChannelModel.unscoped() 321 return VideoChannelModel.unscoped()
322 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) 322 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ])
323 .findById(id) 323 .findByPk(id)
324 } 324 }
325 325
326 static loadByIdAndAccount (id: number, accountId: number) { 326 static loadByIdAndAccount (id: number, accountId: number) {
@@ -339,7 +339,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
339 static loadAndPopulateAccount (id: number) { 339 static loadAndPopulateAccount (id: number) {
340 return VideoChannelModel.unscoped() 340 return VideoChannelModel.unscoped()
341 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) 341 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ])
342 .findById(id) 342 .findByPk(id)
343 } 343 }
344 344
345 static loadByUUIDAndPopulateAccount (uuid: string) { 345 static loadByUUIDAndPopulateAccount (uuid: string) {
@@ -439,7 +439,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
439 439
440 return VideoChannelModel.unscoped() 440 return VideoChannelModel.unscoped()
441 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEOS ]) 441 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEOS ])
442 .findById(id, options) 442 .findByPk(id, options)
443 } 443 }
444 444
445 toFormattedJSON (): VideoChannel { 445 toFormattedJSON (): VideoChannel {
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 7d1e371b9..b861b0704 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -117,7 +117,7 @@ export class VideoFileModel extends Model<VideoFileModel> {
117 ] 117 ]
118 } 118 }
119 119
120 return VideoFileModel.findById(id, options) 120 return VideoFileModel.findByPk(id, options)
121 } 121 }
122 122
123 static async getStats () { 123 static async getStats () {
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index c723e57c0..9bc0f17f5 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -115,7 +115,7 @@ export class VideoImportModel extends Model<VideoImportModel> {
115 } 115 }
116 116
117 static loadAndPopulateVideo (id: number) { 117 static loadAndPopulateVideo (id: number) {
118 return VideoImportModel.findById(id) 118 return VideoImportModel.findByPk(id)
119 } 119 }
120 120
121 static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) { 121 static listUserVideoImportsForApi (userId: number, start: number, count: number, sort: string) {
diff --git a/server/models/video/video-streaming-playlist.ts b/server/models/video/video-streaming-playlist.ts
index bf6f7b0c4..e489f9b0e 100644
--- a/server/models/video/video-streaming-playlist.ts
+++ b/server/models/video/video-streaming-playlist.ts
@@ -110,7 +110,7 @@ export class VideoStreamingPlaylistModel extends Model<VideoStreamingPlaylistMod
110 ] 110 ]
111 } 111 }
112 112
113 return VideoStreamingPlaylistModel.findById(id, options) 113 return VideoStreamingPlaylistModel.findByPk(id, options)
114 } 114 }
115 115
116 static getHlsPlaylistFilename (resolution: number) { 116 static getHlsPlaylistFilename (resolution: number) {
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index fe81fab1a..4516b9c7b 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1313,7 +1313,7 @@ export class VideoModel extends Model<VideoModel> {
1313 1313
1314 static loadWithFiles (id: number, t?: Sequelize.Transaction, logging?: boolean) { 1314 static loadWithFiles (id: number, t?: Sequelize.Transaction, logging?: boolean) {
1315 return VideoModel.scope([ ScopeNames.WITH_FILES, ScopeNames.WITH_STREAMING_PLAYLISTS ]) 1315 return VideoModel.scope([ ScopeNames.WITH_FILES, ScopeNames.WITH_STREAMING_PLAYLISTS ])
1316 .findById(id, { transaction: t, logging }) 1316 .findByPk(id, { transaction: t, logging })
1317 } 1317 }
1318 1318
1319 static loadByUUIDWithFile (uuid: string) { 1319 static loadByUUIDWithFile (uuid: string) {
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 8a9ced7c1..04a3eb97c 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -212,7 +212,7 @@ describe('Test user subscriptions API validators', function () {
212 }) 212 })
213 }) 213 })
214 214
215 describe('When checking if subscriptions exist', async function () { 215 describe('When checking if subscriptions exist', function () {
216 const existPath = path + '/exist' 216 const existPath = path + '/exist'
217 217
218 it('Should fail with a non authenticated user', async function () { 218 it('Should fail with a non authenticated user', async function () {
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index f8f16f54f..164905651 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -142,7 +142,8 @@ describe('Test emails', function () {
142 }) 142 })
143 }) 143 })
144 144
145 describe('When blocking/unblocking user', async function () { 145 describe('When blocking/unblocking user', function () {
146
146 it('Should send the notification email when blocking a user', async function () { 147 it('Should send the notification email when blocking a user', async function () {
147 this.timeout(10000) 148 this.timeout(10000)
148 149
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index ad4c87c73..80f54b7ad 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -241,7 +241,7 @@ describe('Test follows', function () {
241 expect(res.body.data[0].name).to.equal('server3') 241 expect(res.body.data[0].name).to.equal('server3')
242 }) 242 })
243 243
244 describe('Should propagate data on a new following', async function () { 244 describe('Should propagate data on a new following', function () {
245 let video4: Video 245 let video4: Video
246 246
247 before(async function () { 247 before(async function () {