bug fixes

This commit is contained in:
yamanq 2016-08-12 22:05:06 -04:00
parent 70eab47c44
commit 929f31ef97

View File

@ -191,7 +191,7 @@ Meteor.methods({
var currentclass = classes.findOne({_id: work.findOne({_id: workId}).class}); var currentclass = classes.findOne({_id: work.findOne({_id: workId}).class});
var authorized = currentclass.moderators.push(currentclass.admin); var authorized = currentclass.moderators.push(currentclass.admin);
if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']) { if (Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin'])) {
Meteor.update({_id: change._id}, {$set: change}); Meteor.update({_id: change._id}, {$set: change});
} else if (authorized.indexOf(Meteor.userId()) != -1) { } else if (authorized.indexOf(Meteor.userId()) != -1) {
if (change.name.length <= 50 && worktype.indexOf(type) != -1) { if (change.name.length <= 50 && worktype.indexOf(type) != -1) {
@ -222,8 +222,8 @@ Meteor.methods({
if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 && if (currentclass.subscribers.indexOf(Meteor.userId()) != -1 &&
["confirmations", "reports", "done"].indexOf(input[1]) != -1 && ["confirmations", "reports", "done"].indexOf(input[1]) != -1 &&
workobject[input[1]].indexOf(Meteor.userId()) === -1) { workobject[input[1]].indexOf(Meteor.userId()) === -1) {
var currentdone = workobject[input[1]].push(Meteor.userId()); workobject[input[1]] = workobject[input[1]].push(Meteor.userId());
work.update({_id: input[1]}, {$set: {input[1]: currentdone}}); work.update({_id: input[1]}, {$set: workobject});
} }
}, },
'deleteWork': function(workId) { 'deleteWork': function(workId) {