bug fix
This commit is contained in:
parent
ae1c9ea1d1
commit
69b441ec25
@ -37,7 +37,7 @@ Meteor.publish('schools', function() {
|
|||||||
Meteor.publish('classes', function() {
|
Meteor.publish('classes', function() {
|
||||||
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
||||||
return classes.find();
|
return classes.find();
|
||||||
} else if(this.userId !== null) {
|
} else if (this.userId !== null) {
|
||||||
// Return user classes and all _public_ classes.
|
// Return user classes and all _public_ classes.
|
||||||
var userprofile = Meteor.users.findOne(this.userId);
|
var userprofile = Meteor.users.findOne(this.userId);
|
||||||
if (userprofile !== undefined && userprofile.profile.classes !== undefined) {
|
if (userprofile !== undefined && userprofile.profile.classes !== undefined) {
|
||||||
@ -79,7 +79,7 @@ Meteor.publish('classes', function() {
|
|||||||
Meteor.publish('work', function() {
|
Meteor.publish('work', function() {
|
||||||
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
if (Roles.userIsInRole(this.userId, ['superadmin', 'admin'])) {
|
||||||
return work.find();
|
return work.find();
|
||||||
} else if(this.userId !== null) {
|
} else if (this.userId !== null) {
|
||||||
var userprofile = Meteor.users.findOne(this.userId);
|
var userprofile = Meteor.users.findOne(this.userId);
|
||||||
if (userprofile !== undefined && userprofile.profile.classes !== undefined) {
|
if (userprofile !== undefined && userprofile.profile.classes !== undefined) {
|
||||||
return work.find({
|
return work.find({
|
||||||
@ -337,7 +337,9 @@ Meteor.methods({
|
|||||||
var ref = new Date();
|
var ref = new Date();
|
||||||
ref.setHours(0, 0, 0, 0);
|
ref.setHours(0, 0, 0, 0);
|
||||||
ref = ref.getTime();
|
ref = ref.getTime();
|
||||||
var currentwork = change._id;
|
var currentwork = work.findOne({
|
||||||
|
_id: change._id
|
||||||
|
});
|
||||||
var currentclass = classes.findOne({
|
var currentclass = classes.findOne({
|
||||||
_id: currentwork.class
|
_id: currentwork.class
|
||||||
});
|
});
|
||||||
@ -353,7 +355,7 @@ Meteor.methods({
|
|||||||
Meteor.userId() === currentwork.creator) &&
|
Meteor.userId() === currentwork.creator) &&
|
||||||
change.name.length <= 50 && change.description.length <= 150 &&
|
change.name.length <= 50 && change.description.length <= 150 &&
|
||||||
change.dueDate instanceof Date && change.dueDate.getTime() >= ref &&
|
change.dueDate instanceof Date && change.dueDate.getTime() >= ref &&
|
||||||
_.contains(worktype, change.type)){
|
_.contains(worktype, change.type)) {
|
||||||
work.update({
|
work.update({
|
||||||
_id: change._id
|
_id: change._id
|
||||||
}, {
|
}, {
|
||||||
@ -430,7 +432,9 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'deleteWork': function(workId) {
|
'deleteWork': function(workId) {
|
||||||
var currentwork = wokr.findOne({_id: workId});
|
var currentwork = wokr.findOne({
|
||||||
|
_id: workId
|
||||||
|
});
|
||||||
var currentclass = classes.findOne({
|
var currentclass = classes.findOne({
|
||||||
_id: currentwork.class
|
_id: currentwork.class
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user