diff --git a/docs/references/api.md b/docs/references/api.md index 79228feda..3997833e4 100644 --- a/docs/references/api.md +++ b/docs/references/api.md @@ -964,24 +964,6 @@ Response (204): {} ``` -### Tutorial - -POST `/api/v1/profile/tutorial` profile - -Toggles display of the tutorial when the token owner logs in. - -Request: -``` -{ - showTutorial: -} -``` - -Response (204): -``` -{} -``` - ## Settings ### Get auto update pattern diff --git a/migrations/20170117170621-users-drop-showTutorial.js b/migrations/20170117170621-users-drop-showTutorial.js new file mode 100644 index 000000000..9833eaea7 --- /dev/null +++ b/migrations/20170117170621-users-drop-showTutorial.js @@ -0,0 +1,16 @@ +var dbm = global.dbm || require('db-migrate'); +var type = dbm.dataType; + +exports.up = function(db, callback) { + db.runSql('ALTER TABLE users DROP COLUMN showTutorial', function (error) { + if (error) console.error(error); + callback(error); + }); +}; + +exports.down = function(db, callback) { + db.runSql('ALTER TABLE users ADD COLUMN showTutorial BOOLEAN DEFAULT 0', function (error) { + if (error) console.error(error); + callback(error); + }); +}; diff --git a/migrations/schema.sql b/migrations/schema.sql index 26968989a..9e879fcbd 100644 --- a/migrations/schema.sql +++ b/migrations/schema.sql @@ -19,7 +19,6 @@ CREATE TABLE IF NOT EXISTS users( modifiedAt VARCHAR(512) NOT NULL, admin INTEGER NOT NULL, displayName VARCHAR(512) DEFAULT '', - showTutorial BOOLEAN DEFAULT 0, PRIMARY KEY(id)); CREATE TABLE IF NOT EXISTS groups( diff --git a/src/routes/profile.js b/src/routes/profile.js index 3376d83dd..0c703f810 100644 --- a/src/routes/profile.js +++ b/src/routes/profile.js @@ -27,8 +27,7 @@ function get(req, res, next) { email: req.user.email, alternateEmail: req.user.alternateEmail, admin: req.user.admin, - displayName: req.user.displayName, - showTutorial: req.user.showTutorial + displayName: req.user.displayName })); } diff --git a/src/routes/test/oauth2-test.js b/src/routes/test/oauth2-test.js index 6fcd9e6f8..c9bd8d831 100644 --- a/src/routes/test/oauth2-test.js +++ b/src/routes/test/oauth2-test.js @@ -146,8 +146,7 @@ describe('OAuth2', function () { createdAt: (new Date()).toUTCString(), modifiedAt: (new Date()).toUTCString(), resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; var APP_0 = { @@ -1303,8 +1302,7 @@ describe('Password', function () { createdAt: (new Date()).toUTCString(), modifiedAt: (new Date()).toUTCString(), resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; // make csrf always succeed for testing diff --git a/src/routes/test/profile-test.js b/src/routes/test/profile-test.js index 6a5a17cb6..36f6d102b 100644 --- a/src/routes/test/profile-test.js +++ b/src/routes/test/profile-test.js @@ -100,7 +100,6 @@ describe('Profile API', function () { expect(result.body.username).to.equal(USERNAME_0.toLowerCase()); expect(result.body.email).to.equal(EMAIL_0.toLowerCase()); expect(result.body.admin).to.be.ok(); - expect(result.body.showTutorial).to.be.ok(); expect(result.body.displayName).to.be.a('string'); expect(result.body.password).to.not.be.ok(); expect(result.body.salt).to.not.be.ok(); @@ -139,7 +138,6 @@ describe('Profile API', function () { expect(result.body.username).to.equal(USERNAME_0.toLowerCase()); expect(result.body.email).to.equal(EMAIL_0.toLowerCase()); expect(result.body.admin).to.be.ok(); - expect(result.body.showTutorial).to.be.ok(); expect(result.body.displayName).to.be.a('string'); expect(result.body.password).to.not.be.ok(); expect(result.body.salt).to.not.be.ok(); diff --git a/src/test/apps-test.js b/src/test/apps-test.js index 66832fdee..825f43653 100644 --- a/src/test/apps-test.js +++ b/src/test/apps-test.js @@ -30,8 +30,7 @@ describe('Apps', function () { createdAt: 'sometime back', modifiedAt: 'now', resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; var USER_0 = { @@ -43,8 +42,7 @@ describe('Apps', function () { createdAt: 'sometime back', modifiedAt: 'now', resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; var USER_1 = { @@ -56,8 +54,7 @@ describe('Apps', function () { createdAt: 'sometime back', modifiedAt: 'now', resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; var GROUP_0 = { diff --git a/src/test/database-test.js b/src/test/database-test.js index 17bb9970a..faf813314 100644 --- a/src/test/database-test.js +++ b/src/test/database-test.js @@ -31,8 +31,7 @@ var USER_0 = { createdAt: 'sometime back', modifiedAt: 'now', resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; var USER_1 = { @@ -44,8 +43,7 @@ var USER_1 = { createdAt: 'sometime back', modifiedAt: 'now', resetToken: '', - displayName: 'Herbert 1', - showTutorial: false + displayName: 'Herbert 1' }; var USER_2 = { @@ -57,8 +55,7 @@ var USER_2 = { createdAt: 'sometime back', modifiedAt: 'now', resetToken: '', - displayName: 'Herbert 2', - showTutorial: false + displayName: 'Herbert 2' }; describe('database', function () { diff --git a/src/test/groups-test.js b/src/test/groups-test.js index 20b2759a7..0634fe78d 100644 --- a/src/test/groups-test.js +++ b/src/test/groups-test.js @@ -33,8 +33,7 @@ var USER_0 = { createdAt: 'sometime back', modifiedAt: 'now', resetToken: hat(256), - displayName: '', - showTutorial: false + displayName: '' }; function setup(done) { diff --git a/src/user.js b/src/user.js index 7786fd05d..88ba96b16 100644 --- a/src/user.js +++ b/src/user.js @@ -176,8 +176,7 @@ function createUser(username, password, email, displayName, auditSource, options createdAt: now, modifiedAt: now, resetToken: hat(256), - displayName: displayName, - showTutorial: true + displayName: displayName }; asyncIf(!!username, mailboxdb.add.bind(null, username, user.id /* owner */, mailboxdb.TYPE_USER), function (error) { diff --git a/src/userdb.js b/src/userdb.js index 8bc6bc6cd..e9f4eb9ee 100644 --- a/src/userdb.js +++ b/src/userdb.js @@ -23,14 +23,13 @@ var assert = require('assert'), debug = require('debug')('box:userdb'), DatabaseError = require('./databaseerror'); -var USERS_FIELDS = [ 'id', 'username', 'email', 'password', 'salt', 'createdAt', 'modifiedAt', 'resetToken', 'displayName', 'showTutorial' ].join(','); +var USERS_FIELDS = [ 'id', 'username', 'email', 'password', 'salt', 'createdAt', 'modifiedAt', 'resetToken', 'displayName' ].join(','); function postProcess(result) { assert.strictEqual(typeof result, 'object'); // The username may be null or undefined in the db, let's ensure it is a string result.username = result.username || ''; - result.showTutorial = !!result.showTutorial; return result; } @@ -138,11 +137,10 @@ function add(userId, user, callback) { assert.strictEqual(typeof user.modifiedAt, 'string'); assert.strictEqual(typeof user.resetToken, 'string'); assert.strictEqual(typeof user.displayName, 'string'); - assert.strictEqual(typeof user.showTutorial, 'boolean'); assert.strictEqual(typeof callback, 'function'); - var data = [ userId, user.username || null, user.password, user.email, user.salt, user.createdAt, user.modifiedAt, user.resetToken, user.displayName, user.showTutorial ]; - database.query('INSERT INTO users (id, username, password, email, salt, createdAt, modifiedAt, resetToken, displayName, showTutorial) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', data, function (error, result) { + var data = [ userId, user.username || null, user.password, user.email, user.salt, user.createdAt, user.modifiedAt, user.resetToken, user.displayName ]; + database.query('INSERT INTO users (id, username, password, email, salt, createdAt, modifiedAt, resetToken, displayName) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', data, function (error, result) { if (error && error.code === 'ER_DUP_ENTRY') { var msg = error.message; if (error.message.indexOf('users_email') !== -1) { @@ -215,9 +213,6 @@ function update(userId, user, callback) { } else if (k === 'email') { assert.strictEqual(typeof user.email, 'string'); args.push(user.email); - } else if (k === 'showTutorial') { - assert.strictEqual(typeof user.showTutorial, 'boolean'); - args.push(user.showTutorial); } else { args.push(user[k]); } diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index 80123f655..243162fbb 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -206,7 +206,6 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', this._userInfo.alternateEmail = userInfo.alternateEmail; this._userInfo.displayName = userInfo.displayName; this._userInfo.admin = !!userInfo.admin; - this._userInfo.showTutorial = !!userInfo.showTutorial; this._userInfo.gravatar = 'https://www.gravatar.com/avatar/' + md5.createHash(userInfo.alternateEmail || userInfo.email) + '.jpg?s=24&d=mm'; this._userInfo.gravatarHuge = 'https://www.gravatar.com/avatar/' + md5.createHash(userInfo.alternateEmail || userInfo.email) + '.jpg?s=128&d=mm'; };