diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/initializers/migrations/0660-object-storage.ts | 34 | ||||
-rw-r--r-- | server/models/user/user.ts | 2 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 2 |
3 files changed, 18 insertions, 20 deletions
diff --git a/server/initializers/migrations/0660-object-storage.ts b/server/initializers/migrations/0660-object-storage.ts index c815c71c6..53cb89ce6 100644 --- a/server/initializers/migrations/0660-object-storage.ts +++ b/server/initializers/migrations/0660-object-storage.ts | |||
@@ -24,27 +24,25 @@ async function up (utils: { | |||
24 | } | 24 | } |
25 | 25 | ||
26 | { | 26 | { |
27 | await utils.queryInterface.addColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: true }) | 27 | await utils.queryInterface.addColumn('videoFile', 'storage', { |
28 | } | 28 | type: Sequelize.INTEGER, |
29 | { | 29 | allowNull: true, |
30 | await utils.sequelize.query( | 30 | defaultValue: VideoStorage.FILE_SYSTEM |
31 | `UPDATE "videoFile" SET "storage" = ${VideoStorage.FILE_SYSTEM}` | 31 | }) |
32 | ) | 32 | await utils.queryInterface.changeColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: false, defaultValue: null }) |
33 | } | ||
34 | { | ||
35 | await utils.queryInterface.changeColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: false }) | ||
36 | } | 33 | } |
37 | 34 | ||
38 | { | 35 | { |
39 | await utils.queryInterface.addColumn('videoStreamingPlaylist', 'storage', { type: Sequelize.INTEGER, allowNull: true }) | 36 | await utils.queryInterface.addColumn('videoStreamingPlaylist', 'storage', { |
40 | } | 37 | type: Sequelize.INTEGER, |
41 | { | 38 | allowNull: true, |
42 | await utils.sequelize.query( | 39 | defaultValue: VideoStorage.FILE_SYSTEM |
43 | `UPDATE "videoStreamingPlaylist" SET "storage" = ${VideoStorage.FILE_SYSTEM}` | 40 | }) |
44 | ) | 41 | await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'storage', { |
45 | } | 42 | type: Sequelize.INTEGER, |
46 | { | 43 | allowNull: false, |
47 | await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'storage', { type: Sequelize.INTEGER, allowNull: false }) | 44 | defaultValue: null |
45 | }) | ||
48 | } | 46 | } |
49 | } | 47 | } |
50 | 48 | ||
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index 20696b1f4..069d7266e 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -958,7 +958,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
958 | } | 958 | } |
959 | 959 | ||
960 | toMeFormattedJSON (this: MMyUserFormattable): MyUser { | 960 | toMeFormattedJSON (this: MMyUserFormattable): MyUser { |
961 | const formatted = this.toFormattedJSON() | 961 | const formatted = this.toFormattedJSON({ withAdminFlags: true }) |
962 | 962 | ||
963 | const specialPlaylists = this.Account.VideoPlaylists | 963 | const specialPlaylists = this.Account.VideoPlaylists |
964 | .map(p => ({ id: p.id, name: p.name, type: p.type })) | 964 | .map(p => ({ id: p.id, name: p.name, type: p.type })) |
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 1419ae820..318ff832a 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -290,7 +290,7 @@ describe('Test users', function () { | |||
290 | expect(user.account.description).to.be.null | 290 | expect(user.account.description).to.be.null |
291 | } | 291 | } |
292 | 292 | ||
293 | expect(userMe.adminFlags).to.be.undefined | 293 | expect(userMe.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) |
294 | expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) | 294 | expect(userGet.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) |
295 | 295 | ||
296 | expect(userMe.specialPlaylists).to.have.lengthOf(1) | 296 | expect(userMe.specialPlaylists).to.have.lengthOf(1) |