From bd52504d251d6e4e8889421cd394d9608f7eda67 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Tue, 16 Aug 2016 18:14:07 -0400 Subject: [PATCH] push to concat --- hourglass/server/main.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 427b299..5a3a0ef 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -172,7 +172,8 @@ Meteor.methods({ var foundclass = Meteor.findOne({_id: input[1]}); var userlist = input[2]; var index = possiblelist.indexOf(input[2]); - var set = {userlist: foundclass[userlist].push(input[0])}; + var set = {}; + set[userlist] = foundclass[userlist].concat(input[0]); if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { classes.update({_id: input[1]}, {$set: set}); } else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 && @@ -186,7 +187,7 @@ Meteor.methods({ var userlist = input[2]; var index = possiblelist.indexOf(input[2]); var set = {}; - set[userlist] = foundclass[userlist].splice(foundclass[userlist].indexOf(input[0])); + set[userlist] = foundclass[userlist].splice(foundclass[userlist].indexOf(input[0]), 1); if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { classes.update({_id: input[1]}, {$set: set}); } else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 && @@ -249,7 +250,7 @@ Meteor.methods({ _id: change._id }).class }); - var authorized = currentclass.moderators.push(currentclass.admin); + var authorized = currentclass.moderators.concat(currentclass.admin); if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) { work.update({ _id: change._id @@ -303,7 +304,7 @@ Meteor.methods({ if (typeof comment === "string" && comment.length <= 200 && currentclass.subscribers.indexOf(Meteor.userId()) != -1 && currentclass.blockEdit.indexOf(Meteor.userId()) === -1) { - var comments = workobject.comments.push(comment); + var comments = workobject.comments.concat(comment); work.update({ _id: input[1] }, { @@ -325,7 +326,7 @@ Meteor.methods({ if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) { userindex = workobject[input[1]].indexOf(Meteor.userId()); if (userindex === -1) { - workobject[input[1]] = workobject[input[1]].push(Meteor.userId()); + workobject[input[1]] = workobject[input[1]].concat(Meteor.userId()); } else { workobject[input[1]] = workobject[input[1]].splice(userindex, 1); } @@ -342,7 +343,7 @@ Meteor.methods({ _id: workId }).class }); - var authorized = currentclass.moderators.push(currentclass.admin); + var authorized = currentclass.moderators.concat(currentclass.admin); if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) || authorized.indexOf(Meteor.userId()) != -1) { @@ -398,7 +399,7 @@ Meteor.methods({ prof.classes.indexOf(change) === -1) { classes.update({_id: found._id}, {$set: {subscribers: found.subscribers + 1}}); var current = Meteor.user().profile; - current.classes.push(change); + current.classes.concat(change); Meteor.users.update({ _id: Meteor.userId() }, {