fix various bugs
This commit is contained in:
parent
106f72f1e9
commit
fcdbca066c
@ -30,7 +30,7 @@ work.schema = new SimpleSchema({
|
|||||||
dueDate: {type: Date},
|
dueDate: {type: Date},
|
||||||
description: {type: String, optional: true},
|
description: {type: String, optional: true},
|
||||||
creator: {type: String},
|
creator: {type: String},
|
||||||
comments: {type: [String], optional: true},
|
comments: {type: [Object], blackbox: true, optional: true},
|
||||||
confirmations: {type: [String], optional: true},
|
confirmations: {type: [String], optional: true},
|
||||||
reports: {type: [String], optional: true},
|
reports: {type: [String], optional: true},
|
||||||
attachments: {type: [String], optional: true},
|
attachments: {type: [String], optional: true},
|
||||||
|
|||||||
@ -206,7 +206,7 @@ function securityCheck(checklist, input) {
|
|||||||
break;
|
break;
|
||||||
// Description too long
|
// Description too long
|
||||||
case 12:
|
case 12:
|
||||||
if (typeof input.description !== "string" || input.description.length > 150) error = 11;
|
if ((typeof input.description !== "string" || input.description.length > 150) && input.description !== undefined) error = 11;
|
||||||
break;
|
break;
|
||||||
// Moderator of class
|
// Moderator of class
|
||||||
case 13:
|
case 13:
|
||||||
@ -250,7 +250,7 @@ function securityCheck(checklist, input) {
|
|||||||
break;
|
break;
|
||||||
// Toggling possible toggleWork
|
// Toggling possible toggleWork
|
||||||
case 23:
|
case 23:
|
||||||
if(_.contains(["confirmations", "reports", "done"], input.toggle)) error = errors.length - 1;
|
if(!_.contains(["confirmations", "reports", "done"], input.toggle)) error = errors.length - 1;
|
||||||
break;
|
break;
|
||||||
// Class is approved
|
// Class is approved
|
||||||
case 24:
|
case 24:
|
||||||
@ -471,7 +471,7 @@ Meteor.methods({
|
|||||||
_id: currentwork.class
|
_id: currentwork.class
|
||||||
});
|
});
|
||||||
var security = securityCheck([[1, 16, 13, 5, false], 11, 12, 10, 20, true],
|
var security = securityCheck([[1, 16, 13, 5, false], 11, 12, 10, 20, true],
|
||||||
Object.assign(currentclass, currentwork, {description: change.description, name: change.name, dueDate: change.dueDate, type: change.type}));
|
Object.assign(currentclass || {}, currentwork, {description: change.description, name: change.name, dueDate: change.dueDate, type: change.type}));
|
||||||
if (!security) {
|
if (!security) {
|
||||||
work.update({
|
work.update({
|
||||||
_id: change._id
|
_id: change._id
|
||||||
@ -498,19 +498,19 @@ Meteor.methods({
|
|||||||
});
|
});
|
||||||
var user = Meteor.userId();
|
var user = Meteor.userId();
|
||||||
var security = securityCheck([15, [16, [8, 9, true], false]],
|
var security = securityCheck([15, [16, [8, 9, true], false]],
|
||||||
Object.assign(workobject, currentclass, {userId: Meteor.userId(), comment: comment}));
|
Object.assign(workobject, currentclass || {}, {userId: user, comment: comment}));
|
||||||
if (!security) {
|
if (!security) {
|
||||||
var commentInfo = {
|
var commentInfo = {
|
||||||
"comment": input[0],
|
"comment": comment,
|
||||||
"user": user,
|
"user": user,
|
||||||
"date": new Date()
|
"date": new Date()
|
||||||
};
|
};
|
||||||
var comments = workobject.comments.concat(commentInfo);
|
var newchain = workobject.comments.concat(commentInfo);
|
||||||
work.update({
|
work.update({
|
||||||
_id: input[1]
|
_id: input[1]
|
||||||
}, {
|
}, {
|
||||||
$set: {
|
$set: {
|
||||||
comments: comments
|
comments: newchain
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -525,8 +525,8 @@ Meteor.methods({
|
|||||||
var currentclass = classes.findOne({
|
var currentclass = classes.findOne({
|
||||||
_id: workobject.class
|
_id: workobject.class
|
||||||
});
|
});
|
||||||
var security = securityCheck([[16, 9, false], 23],
|
var security = securityCheck([[16, 9, false], 23, true],
|
||||||
Object.assign(workobject, currentclass, {userId: Meteor.userId(), toggle: input[1]}));
|
Object.assign(workobject, currentclass || {}, {userId: Meteor.userId(), toggle: input[1]}));
|
||||||
if (!security) {
|
if (!security) {
|
||||||
var userindex = workobject[input[1]].indexOf(Meteor.userId());
|
var userindex = workobject[input[1]].indexOf(Meteor.userId());
|
||||||
if (userindex === -1) {
|
if (userindex === -1) {
|
||||||
@ -557,7 +557,8 @@ Meteor.methods({
|
|||||||
var currentclass = classes.findOne({
|
var currentclass = classes.findOne({
|
||||||
_id: currentwork.class
|
_id: currentwork.class
|
||||||
});
|
});
|
||||||
var security = securityCheck([1, 16, 13, 5]);
|
var security = securityCheck([1, 16, 13, 5, false],
|
||||||
|
Object.assign(currentwork, currentclass || {}));
|
||||||
if (!security) {
|
if (!security) {
|
||||||
work.remove({
|
work.remove({
|
||||||
_id: workId
|
_id: workId
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user