aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorAndréas Livet <andreas.livet@gmail.com>2017-12-19 10:45:49 +0100
committerChocobozzz <me@florianbigard.com>2017-12-19 10:45:49 +0100
commit7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd (patch)
tree56116e7e9f8467b78ed6dfc81827288915d31c8c /server/initializers
parent228077efd73485a2832bb6211c9fa923158c2112 (diff)
downloadPeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.gz
PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.zst
PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.zip
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
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0130-user-autoplay-video.ts27
2 files changed, 28 insertions, 1 deletions
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'
8 8
9// --------------------------------------------------------------------------- 9// ---------------------------------------------------------------------------
10 10
11const LAST_MIGRATION_VERSION = 125 11const LAST_MIGRATION_VERSION = 130
12 12
13// --------------------------------------------------------------------------- 13// ---------------------------------------------------------------------------
14 14
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 @@
1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
3
4function up (utils: {
5 transaction: Sequelize.Transaction,
6 queryInterface: Sequelize.QueryInterface,
7 sequelize: Sequelize.Sequelize
8}): Promise<void> {
9 const q = utils.queryInterface
10
11 const data = {
12 type: Sequelize.BOOLEAN,
13 allowNull: false,
14 defaultValue: true
15 }
16
17 return q.addColumn('user', 'autoPlayVideo', data)
18}
19
20function down (options) {
21 throw new Error('Not implemented.')
22}
23
24export {
25 up,
26 down
27}