summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/boards.js2
-rw-r--r--models/users.js16
2 files changed, 9 insertions, 9 deletions
diff --git a/models/boards.js b/models/boards.js
index 4d9fd7c0..1d365a95 100644
--- a/models/boards.js
+++ b/models/boards.js
@@ -279,7 +279,7 @@ Boards.before.insert((userId, doc) => {
// Handle labels
const colors = Boards.simpleSchema()._schema['labels.$.color'].allowedValues;
const defaultLabelsColors = _.clone(colors).splice(0, 6);
- doc.labels = _.map(defaultLabelsColors, (color) => {
+ doc.labels = defaultLabelsColors.map((color) => {
return {
color,
_id: Random.id(6),
diff --git a/models/users.js b/models/users.js
index 1ea09a03..b35104ec 100644
--- a/models/users.js
+++ b/models/users.js
@@ -14,13 +14,13 @@ Users.helpers({
},
starredBoards() {
- const starredBoardIds = this.profile.starredBoards || [];
- return Boards.find({archived: false, _id: {$in: starredBoardIds}});
+ const {starredBoards = []} = this.profile;
+ return Boards.find({archived: false, _id: {$in: starredBoards}});
},
hasStarred(boardId) {
- const starredBoardIds = this.profile.starredBoards || [];
- return _.contains(starredBoardIds, boardId);
+ const {starredBoards = []} = this.profile;
+ return _.contains(starredBoards, boardId);
},
isBoardMember() {
@@ -54,9 +54,9 @@ Users.helpers({
return profile.initials;
else if (profile.fullname) {
- return _.reduce(profile.fullname.split(/\s+/), (memo, word) => {
+ return profile.fullname.split(/\s+/).reduce((memo = '', word) => {
return memo + word[0];
- }, '').toUpperCase();
+ }).toUpperCase();
} else {
return this.username[0].toUpperCase();
@@ -130,7 +130,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) {
- _.forEach(boardsIds, (boardId) => {
+ boardsIds.forEach((boardId) => {
Boards.update(boardId, {$inc: {stars: inc}});
});
}
@@ -149,7 +149,7 @@ if (Meteor.isServer) {
// Insert the Welcome Board
Boards.insert(ExampleBoard, (err, boardId) => {
- _.forEach(['Basics', 'Advanced'], (title) => {
+ ['Basics', 'Advanced'].forEach((title) => {
const list = {
title,
boardId,