push to concat
This commit is contained in:
parent
460ce03c0f
commit
bd52504d25
@ -172,7 +172,8 @@ Meteor.methods({
|
|||||||
var foundclass = Meteor.findOne({_id: input[1]});
|
var foundclass = Meteor.findOne({_id: input[1]});
|
||||||
var userlist = input[2];
|
var userlist = input[2];
|
||||||
var index = possiblelist.indexOf(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'])) {
|
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||||
classes.update({_id: input[1]}, {$set: set});
|
classes.update({_id: input[1]}, {$set: set});
|
||||||
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
|
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
|
||||||
@ -186,7 +187,7 @@ Meteor.methods({
|
|||||||
var userlist = input[2];
|
var userlist = input[2];
|
||||||
var index = possiblelist.indexOf(input[2]);
|
var index = possiblelist.indexOf(input[2]);
|
||||||
var set = {};
|
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'])) {
|
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||||
classes.update({_id: input[1]}, {$set: set});
|
classes.update({_id: input[1]}, {$set: set});
|
||||||
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
|
} else if (foundclass && foundclass.admin == Meteor.userId() && index !== -1 &&
|
||||||
@ -249,7 +250,7 @@ Meteor.methods({
|
|||||||
_id: change._id
|
_id: change._id
|
||||||
}).class
|
}).class
|
||||||
});
|
});
|
||||||
var authorized = currentclass.moderators.push(currentclass.admin);
|
var authorized = currentclass.moderators.concat(currentclass.admin);
|
||||||
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
|
||||||
work.update({
|
work.update({
|
||||||
_id: change._id
|
_id: change._id
|
||||||
@ -303,7 +304,7 @@ Meteor.methods({
|
|||||||
if (typeof comment === "string" && comment.length <= 200 &&
|
if (typeof comment === "string" && comment.length <= 200 &&
|
||||||
currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
|
currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
|
||||||
currentclass.blockEdit.indexOf(Meteor.userId()) === -1) {
|
currentclass.blockEdit.indexOf(Meteor.userId()) === -1) {
|
||||||
var comments = workobject.comments.push(comment);
|
var comments = workobject.comments.concat(comment);
|
||||||
work.update({
|
work.update({
|
||||||
_id: input[1]
|
_id: input[1]
|
||||||
}, {
|
}, {
|
||||||
@ -325,7 +326,7 @@ Meteor.methods({
|
|||||||
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
|
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1) {
|
||||||
userindex = workobject[input[1]].indexOf(Meteor.userId());
|
userindex = workobject[input[1]].indexOf(Meteor.userId());
|
||||||
if (userindex === -1) {
|
if (userindex === -1) {
|
||||||
workobject[input[1]] = workobject[input[1]].push(Meteor.userId());
|
workobject[input[1]] = workobject[input[1]].concat(Meteor.userId());
|
||||||
} else {
|
} else {
|
||||||
workobject[input[1]] = workobject[input[1]].splice(userindex, 1);
|
workobject[input[1]] = workobject[input[1]].splice(userindex, 1);
|
||||||
}
|
}
|
||||||
@ -342,7 +343,7 @@ Meteor.methods({
|
|||||||
_id: workId
|
_id: workId
|
||||||
}).class
|
}).class
|
||||||
});
|
});
|
||||||
var authorized = currentclass.moderators.push(currentclass.admin);
|
var authorized = currentclass.moderators.concat(currentclass.admin);
|
||||||
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) ||
|
||||||
authorized.indexOf(Meteor.userId()) != -1) {
|
authorized.indexOf(Meteor.userId()) != -1) {
|
||||||
|
|
||||||
@ -398,7 +399,7 @@ Meteor.methods({
|
|||||||
prof.classes.indexOf(change) === -1) {
|
prof.classes.indexOf(change) === -1) {
|
||||||
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers + 1}});
|
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers + 1}});
|
||||||
var current = Meteor.user().profile;
|
var current = Meteor.user().profile;
|
||||||
current.classes.push(change);
|
current.classes.concat(change);
|
||||||
Meteor.users.update({
|
Meteor.users.update({
|
||||||
_id: Meteor.userId()
|
_id: Meteor.userId()
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user