From 7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9as=20Livet?= Date: Tue, 19 Dec 2017 10:45:49 +0100 Subject: Enh #106 : Add an autoPlayVideo user attribute (#159) Warning : I was not able to run the tests on my machine. It uses a different approach to handle databse connexion and didn't find where to configure it... - create a migration file to add a boolean column in user table - add autoPlayVideo attribute everywhere it is needed (both on client and server side) - add tests - add a way to configure this attribute in account-settings - use the attribute in video-watch component to actually autoplay or not the video --- server/initializers/constants.ts | 2 +- .../migrations/0130-user-autoplay-video.ts | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 server/initializers/migrations/0130-user-autoplay-video.ts (limited to 'server/initializers') diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 341086bd6..ff322730f 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -8,7 +8,7 @@ import { isTestInstance, root } from '../helpers/core-utils' // --------------------------------------------------------------------------- -const LAST_MIGRATION_VERSION = 125 +const LAST_MIGRATION_VERSION = 130 // --------------------------------------------------------------------------- diff --git a/server/initializers/migrations/0130-user-autoplay-video.ts b/server/initializers/migrations/0130-user-autoplay-video.ts new file mode 100644 index 000000000..9f6878e39 --- /dev/null +++ b/server/initializers/migrations/0130-user-autoplay-video.ts @@ -0,0 +1,27 @@ +import * as Sequelize from 'sequelize' +import * as Promise from 'bluebird' + +function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + const q = utils.queryInterface + + const data = { + type: Sequelize.BOOLEAN, + allowNull: false, + defaultValue: true + } + + return q.addColumn('user', 'autoPlayVideo', data) +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3