Browse Source

Add auto play next video migration

Chocobozzz 4 years ago
parent
commit
85c1df6ae8

+ 2 - 0
client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html

@@ -47,7 +47,9 @@
       inputName="autoPlayVideo" formControlName="autoPlayVideo"
       i18n-labelText labelText="Automatically plays video"
     ></my-peertube-checkbox>
+  </div>
 
+  <div class="form-group">
     <my-peertube-checkbox
       inputName="autoPlayNextVideo" formControlName="autoPlayNextVideo"
       i18n-labelText labelText="Automatically starts playing next video"

+ 1 - 1
server/initializers/constants.ts

@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 435
+const LAST_MIGRATION_VERSION = 440
 
 // ---------------------------------------------------------------------------
 

+ 27 - 0
server/initializers/migrations/0440-user-auto-play-next-video.ts

@@ -0,0 +1,27 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+  transaction: Sequelize.Transaction,
+  queryInterface: Sequelize.QueryInterface,
+  sequelize: Sequelize.Sequelize,
+  db: any
+}): Promise<void> {
+  {
+    const data = {
+      type: Sequelize.BOOLEAN,
+      allowNull: false,
+      defaultValue: false
+    }
+
+    await utils.queryInterface.addColumn('user', 'autoPlayNextVideo', data)
+  }
+}
+
+function down (options) {
+  throw new Error('Not implemented.')
+}
+
+export {
+  up,
+  down
+}