summaryrefslogtreecommitdiffstats
path: root/models/users.js
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /models/users.js
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'models/users.js')
-rw-r--r--models/users.js40
1 files changed, 18 insertions, 22 deletions
diff --git a/models/users.js b/models/users.js
index 306193aa..79b83fe6 100644
--- a/models/users.js
+++ b/models/users.js
@@ -247,7 +247,7 @@ Users.attachSchema(
optional: false,
defaultValue: 'password',
},
- })
+ }),
);
Users.allow({
@@ -259,7 +259,7 @@ Users.allow({
const adminsNumber = Users.find({ isAdmin: true }).count();
const { isAdmin } = Users.findOne(
{ _id: userId },
- { fields: { isAdmin: 1 } }
+ { fields: { isAdmin: 1 } },
);
// Prevents remove of the only one administrator
@@ -533,7 +533,7 @@ Meteor.methods({
check(email, String);
const existingUser = Users.findOne(
{ 'emails.address': email },
- { fields: { _id: 1 } }
+ { fields: { _id: 1 } },
);
if (existingUser) {
throw new Meteor.Error('email-already-taken');
@@ -700,7 +700,7 @@ if (Meteor.isServer) {
if (!options || !options.profile) {
throw new Meteor.Error(
'error-invitation-code-blank',
- 'The invitation code is required'
+ 'The invitation code is required',
);
}
const invitationCode = InvitationCodes.findOne({
@@ -711,7 +711,8 @@ if (Meteor.isServer) {
if (!invitationCode) {
throw new Meteor.Error(
'error-invitation-code-not-exist',
- 'The invitation code doesn\'t exist'
+ // eslint-disable-next-line quotes
+ "The invitation code doesn't exist",
);
} else {
user.profile = { icode: options.profile.invitationcode };
@@ -722,18 +723,13 @@ if (Meteor.isServer) {
Meteor.bindEnvironment(() => {
InvitationCodes.remove({ _id: invitationCode._id });
}),
- 200
+ 200,
);
return user;
}
});
}
-Users.before.update((userId, doc, fieldNames, modifier, options) => {
- modifier.$set = modifier.$set || {};
- modifier.$set.modifiedAt = Date.now();
-});
-
if (Meteor.isServer) {
// Let mongoDB ensure username unicity
Meteor.startup(() => {
@@ -742,7 +738,7 @@ if (Meteor.isServer) {
{
username: 1,
},
- { unique: true }
+ { unique: true },
);
});
@@ -786,7 +782,7 @@ if (Meteor.isServer) {
// b. We use it to find deleted and newly inserted ids by using it in one
// direction and then in the other.
function incrementBoards(boardsIds, inc) {
- boardsIds.forEach((boardId) => {
+ boardsIds.forEach(boardId => {
Boards.update(boardId, { $inc: { stars: inc } });
});
}
@@ -855,7 +851,7 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.cardTemplatesSwimlaneId': swimlaneId },
});
- }
+ },
);
// Insert the list templates swimlane
@@ -872,7 +868,7 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.listTemplatesSwimlaneId': swimlaneId },
});
- }
+ },
);
// Insert the board templates swimlane
@@ -889,9 +885,9 @@ if (Meteor.isServer) {
Users.update(fakeUserId.get(), {
$set: { 'profile.boardTemplatesSwimlaneId': swimlaneId },
});
- }
+ },
);
- }
+ },
);
});
});
@@ -921,7 +917,7 @@ if (Meteor.isServer) {
if (!invitationCode) {
throw new Meteor.Error('error-invitation-code-not-exist');
} else {
- invitationCode.boardsToBeInvited.forEach((boardId) => {
+ invitationCode.boardsToBeInvited.forEach(boardId => {
const board = Boards.findOne(boardId);
board.addMember(doc._id);
});
@@ -1071,7 +1067,7 @@ if (Meteor.isServer) {
loginDisabled: true,
'services.resume.loginTokens': '',
},
- }
+ },
);
} else if (action === 'enableLogin') {
Users.update({ _id: id }, { $set: { loginDisabled: '' } });
@@ -1112,7 +1108,7 @@ if (Meteor.isServer) {
*/
JsonRoutes.add('POST', '/api/boards/:boardId/members/:userId/add', function(
req,
- res
+ res,
) {
try {
Authentication.checkUserId(req.userId);
@@ -1136,7 +1132,7 @@ if (Meteor.isServer) {
isTrue(isAdmin),
isTrue(isNoComments),
isTrue(isCommentOnly),
- userId
+ userId,
);
}
return {
@@ -1207,7 +1203,7 @@ if (Meteor.isServer) {
data: error,
});
}
- }
+ },
);
/**