Remove now unused tutorial route and business logic
We can bring that back again if needed
This commit is contained in:
+1
-16
@@ -3,8 +3,7 @@
|
|||||||
exports = module.exports = {
|
exports = module.exports = {
|
||||||
get: get,
|
get: get,
|
||||||
update: update,
|
update: update,
|
||||||
changePassword: changePassword,
|
changePassword: changePassword
|
||||||
setShowTutorial: setShowTutorial
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var assert = require('assert'),
|
var assert = require('assert'),
|
||||||
@@ -66,17 +65,3 @@ function changePassword(req, res, next) {
|
|||||||
next(new HttpSuccess(204));
|
next(new HttpSuccess(204));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setShowTutorial(req, res, next) {
|
|
||||||
assert.strictEqual(typeof req.user, 'object');
|
|
||||||
assert.strictEqual(typeof req.body, 'object');
|
|
||||||
|
|
||||||
if (typeof req.body.showTutorial !== 'boolean') return next(new HttpError(400, 'showTutorial must be a boolean.'));
|
|
||||||
|
|
||||||
user.setShowTutorial(req.user.id, req.body.showTutorial, function (error) {
|
|
||||||
if (error && error.reason === UserError.NOT_FOUND) return next(new HttpError(403, 'Wrong password'));
|
|
||||||
if (error) return next(new HttpError(500, error));
|
|
||||||
|
|
||||||
next(new HttpSuccess(204));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ function initializeExpressSync() {
|
|||||||
router.get ('/api/v1/profile', profileScope, routes.profile.get);
|
router.get ('/api/v1/profile', profileScope, routes.profile.get);
|
||||||
router.post('/api/v1/profile', profileScope, routes.profile.update);
|
router.post('/api/v1/profile', profileScope, routes.profile.update);
|
||||||
router.post('/api/v1/profile/password', profileScope, routes.user.verifyPassword, routes.profile.changePassword);
|
router.post('/api/v1/profile/password', profileScope, routes.user.verifyPassword, routes.profile.changePassword);
|
||||||
router.post('/api/v1/profile/tutorial', profileScope, routes.profile.setShowTutorial);
|
|
||||||
|
|
||||||
// user routes
|
// user routes
|
||||||
router.get ('/api/v1/users', usersScope, routes.user.requireAdmin, routes.user.list);
|
router.get ('/api/v1/users', usersScope, routes.user.requireAdmin, routes.user.list);
|
||||||
|
|||||||
+1
-15
@@ -21,8 +21,7 @@ exports = module.exports = {
|
|||||||
sendInvite: sendInvite,
|
sendInvite: sendInvite,
|
||||||
setGroups: setGroups,
|
setGroups: setGroups,
|
||||||
setAliases: setAliases,
|
setAliases: setAliases,
|
||||||
getAliases: getAliases,
|
getAliases: getAliases
|
||||||
setShowTutorial: setShowTutorial
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var assert = require('assert'),
|
var assert = require('assert'),
|
||||||
@@ -623,19 +622,6 @@ function sendInvite(userId, options, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setShowTutorial(userId, showTutorial, callback) {
|
|
||||||
assert.strictEqual(typeof userId, 'string');
|
|
||||||
assert.strictEqual(typeof showTutorial, 'boolean');
|
|
||||||
assert.strictEqual(typeof callback, 'function');
|
|
||||||
|
|
||||||
userdb.update(userId, { showTutorial: showTutorial }, function (error) {
|
|
||||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND, error));
|
|
||||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
|
||||||
|
|
||||||
callback(null);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAliases(userId, aliases, callback) {
|
function setAliases(userId, aliases, callback) {
|
||||||
assert.strictEqual(typeof userId, 'string');
|
assert.strictEqual(typeof userId, 'string');
|
||||||
assert(util.isArray(aliases));
|
assert(util.isArray(aliases));
|
||||||
|
|||||||
@@ -994,15 +994,6 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
|
|||||||
return (available - needed) >= 0;
|
return (available - needed) >= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.prototype.setShowTutorial = function (show, callback) {
|
|
||||||
var data = { showTutorial: show };
|
|
||||||
|
|
||||||
post('/api/v1/profile/tutorial', data).success(function (data, status) {
|
|
||||||
if (status !== 204) return callback(new ClientError(status, data));
|
|
||||||
callback(null);
|
|
||||||
}).error(defaultErrorHandler(callback));
|
|
||||||
};
|
|
||||||
|
|
||||||
client = new Client();
|
client = new Client();
|
||||||
return client;
|
return client;
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
Reference in New Issue
Block a user