refactor: tab rules

isekai-main
Barış Soner Uşaklı 3 years ago
parent c26870d227
commit fb363957d1

@ -146,7 +146,7 @@
"@commitlint/config-angular": "14.1.0", "@commitlint/config-angular": "14.1.0",
"coveralls": "3.1.1", "coveralls": "3.1.1",
"eslint": "7.32.0", "eslint": "7.32.0",
"eslint-config-nodebb": "0.0.3", "eslint-config-nodebb": "0.1.1",
"eslint-plugin-import": "2.25.3", "eslint-plugin-import": "2.25.3",
"grunt": "1.4.1", "grunt": "1.4.1",
"grunt-contrib-watch": "1.1.0", "grunt-contrib-watch": "1.1.0",

@ -21,7 +21,7 @@ privilegesController.get = async function (req, res) {
name: '[[admin/manage/privileges:global]]', name: '[[admin/manage/privileges:global]]',
icon: 'fa-list', icon: 'fa-list',
}, { }, {
cid: 'admin', // what do? cid: 'admin',
name: '[[admin/manage/privileges:admin]]', name: '[[admin/manage/privileges:admin]]',
icon: 'fa-lock', icon: 'fa-lock',
}]; }];

@ -388,7 +388,9 @@ authenticationController.onSuccessfulLogin = async function (req, uid) {
version: req.useragent.version, version: req.useragent.version,
}); });
await Promise.all([ await Promise.all([
new Promise(resolve => req.session.save(resolve)), new Promise((resolve) => {
req.session.save(resolve);
}),
user.auth.addSession(uid, req.sessionID), user.auth.addSession(uid, req.sessionID),
user.updateLastOnlineTime(uid), user.updateLastOnlineTime(uid),
user.updateOnlineUsers(uid), user.updateOnlineUsers(uid),

@ -137,9 +137,7 @@ Auth.reloadRoutes = async function (params) {
res.locals.strategy = strategy; res.locals.strategy = strategy;
next(); next();
})(req, res, next); })(req, res, next);
}, }, Auth.middleware.validateAuth, (req, res, next) => {
Auth.middleware.validateAuth,
(req, res, next) => {
async.waterfall([ async.waterfall([
async.apply(req.login.bind(req), res.locals.user), async.apply(req.login.bind(req), res.locals.user),
async.apply(controllers.authentication.onSuccessfulLogin, req, req.uid), async.apply(controllers.authentication.onSuccessfulLogin, req, req.uid),

@ -243,54 +243,6 @@ describe('Upload Controllers', () => {
}); });
}); });
// it('should fail if topic thumbs are disabled', function (done) {
// helpers.uploadFile(
// nconf.get('url') + '/api/topic/thumb/upload',
// path.join(__dirname, '../test/files/test.png'),
// {}, jar, csrf_token,
// function (err, res, body) {
// assert.ifError(err);
// assert.strictEqual(res.statusCode, 404);
// console.log(body);
// assert(body && body.status && body.status.code);
// assert.strictEqual(body.status.code, '[[error:topic-thumbnails-are-disabled]]');
// done();
// }
// );
// });
// it('should fail if file is not image', function (done) {
// meta.config.allowTopicsThumbnail = 1;
// helpers.uploadFile(
// nconf.get('url') + '/api/topic/thumb/upload',
// path.join(__dirname, '../test/files/503.html'),
// {}, jar, csrf_token,
// function (err, res, body) {
// assert.ifError(err);
// assert.equal(res.statusCode, 500);
// assert.equal(body.error, '[[error:invalid-file]]');
// done();
// }
// );
// });
// it('should upload topic thumb', function (done) {
// meta.config.allowTopicsThumbnail = 1;
// helpers.uploadFile(
// nconf.get('url') + '/api/topic/thumb/upload',
// path.join(__dirname, '../test/files/test.png'),
// {}, jar, csrf_token,
// function (err, res, body) {
// assert.ifError(err);
// assert.equal(res.statusCode, 200);
// assert(Array.isArray(body));
// assert(body[0].path);
// assert(body[0].url);
// done();
// }
// );
// });
it('should not allow non image uploads', (done) => { it('should not allow non image uploads', (done) => {
socketUser.updateCover({ uid: 1 }, { uid: 1, file: { path: '../../text.txt' } }, (err) => { socketUser.updateCover({ uid: 1 }, { uid: 1, file: { path: '../../text.txt' } }, (err) => {
assert.equal(err.message, '[[error:invalid-data]]'); assert.equal(err.message, '[[error:invalid-data]]');

@ -259,6 +259,7 @@ describe('Utility Methods', () => {
}); });
it('should return passed in value if invalid', (done) => { it('should return passed in value if invalid', (done) => {
// eslint-disable-next-line no-loss-of-precision
const bigInt = -111111111111111111; const bigInt = -111111111111111111;
const result = utils.toISOString(bigInt); const result = utils.toISOString(bigInt);
assert.equal(bigInt, result); assert.equal(bigInt, result);

Loading…
Cancel
Save