feat: redirect /me to user profile

v1.18.x
Barış Soner Uşaklı 5 years ago
parent d92032dad1
commit 3be4d5f7d5

@ -7,6 +7,7 @@ module.exports = function (app, middleware, controllers) {
var middlewares = [middleware.exposeUid, middleware.canViewUsers]; var middlewares = [middleware.exposeUid, middleware.canViewUsers];
var accountMiddlewares = [middleware.exposeUid, middleware.canViewUsers, middleware.checkAccountPermissions]; var accountMiddlewares = [middleware.exposeUid, middleware.canViewUsers, middleware.checkAccountPermissions];
app.get('/me', middleware.redirectMeToUserslug);
setupPageRoute(app, '/me/*', middleware, [], middleware.redirectMeToUserslug); setupPageRoute(app, '/me/*', middleware, [], middleware.redirectMeToUserslug);
setupPageRoute(app, '/uid/:uid*', middleware, [], middleware.redirectUidToUserslug); setupPageRoute(app, '/uid/:uid*', middleware, [], middleware.redirectUidToUserslug);

@ -1070,6 +1070,15 @@ describe('Controllers', function () {
}); });
describe('/me/*', function () { describe('/me/*', function () {
it('should redirect to user profile', function (done) {
request(nconf.get('url') + '/me', { jar: jar, json: true }, function (err, res, body) {
assert.ifError(err);
assert.equal(res.statusCode, 200);
assert(body.includes('template: "account/profile"'));
assert(body.includes('"username":"foo"'));
done();
});
});
it('api should redirect to /user/[userslug]/bookmarks', function (done) { it('api should redirect to /user/[userslug]/bookmarks', function (done) {
request(nconf.get('url') + '/api/me/bookmarks', { jar: jar, json: true }, function (err, res, body) { request(nconf.get('url') + '/api/me/bookmarks', { jar: jar, json: true }, function (err, res, body) {
assert.ifError(err); assert.ifError(err);

Loading…
Cancel
Save