Skip to content

Commit 9394dc2

Browse files
committed
fix lint in routes/deprecated
1 parent 2182c74 commit 9394dc2

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

routes/deprecated.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ const addDeprecatedRoutes = function addDeprecatedRoutes(app) {
259259
}
260260
}
261261
connection.dbname = connection.dbname || connection.pouchname;
262-
for (const attrib in defaultConnection) {
263-
if (defaultConnection.hasOwnProperty(attrib) && !connection[attrib]) {
262+
Object.keys(defaultConnection).forEach((attrib) => {
263+
if (!connection[attrib]) {
264264
connection[attrib] = defaultConnection[attrib];
265265
}
266-
}
266+
});
267267
if (req.body.dbname && connection.dbname === 'default') {
268268
connection.dbname = req.body.dbname;
269269
}
@@ -298,8 +298,7 @@ const addDeprecatedRoutes = function addDeprecatedRoutes(app) {
298298
return '';
299299
}
300300
if (!userPermission.message) {
301-
userPermission.message = 'There was a problem processing this user permission, Please report this 3134.';
302-
debug(userPermission, userPermission.message);
301+
return 'There was a problem processing this user permission, Please report this 3134.';
303302
}
304303
return userPermission.message;
305304
});
@@ -317,7 +316,6 @@ const addDeprecatedRoutes = function addDeprecatedRoutes(app) {
317316
if (err.message === 'ending the request') {
318317
return;
319318
}
320-
console.log(err, 'in the error handle');
321319

322320
// res.status(cleanErrorStatus(err.statusCode || err.status) || 500);
323321
// returndata.status = cleanErrorStatus(err.statusCode || err.status) || 500;
@@ -433,13 +431,13 @@ const addDeprecatedRoutes = function addDeprecatedRoutes(app) {
433431
req.body.userRoleInfo.dbname = req.body.userRoleInfo.dbname || req.body.userRoleInfo.pouchname;
434432
const roles = [];
435433
if (!req.body.roles && req.body.userRoleInfo) {
436-
for (const role in req.body.userRoleInfo) {
437-
if (req.body.userRoleInfo.hasOwnProperty(role)) {
438-
if (req.body.userRoleInfo[role] && (role === 'admin' || role === 'writer' || role === 'reader' || role === 'commenter')) {
439-
roles.push(`${req.body.userRoleInfo.dbname}_${role}`);
440-
}
434+
Object.keys(req.body.userRoleInfo).forEach((role) => {
435+
// if (req.body.userRoleInfo.hasOwnProperty(role)) {
436+
if (req.body.userRoleInfo[role] && (role === 'admin' || role === 'writer' || role === 'reader' || role === 'commenter')) {
437+
roles.push(`${req.body.userRoleInfo.dbname}_${role}`);
441438
}
442-
}
439+
// }
440+
});
443441
}
444442
req.body.roles = req.body.roles || roles;
445443
debug(`${new Date()} updateroles is DEPRECATED, using the addroletouser route to process this request`, roles);

0 commit comments

Comments
 (0)