reorderClasses
This commit is contained in:
parent
2908c46452
commit
006f9db206
@ -465,7 +465,7 @@ Meteor.methods({
|
|||||||
"__proto__": current.__proto__,
|
"__proto__": current.__proto__,
|
||||||
"school": change.school,
|
"school": change.school,
|
||||||
"grade": change.grade,
|
"grade": change.grade,
|
||||||
"classes": change.classes,
|
"classes": current.classes,
|
||||||
"description": change.description,
|
"description": change.description,
|
||||||
"avatar": change.avatar,
|
"avatar": change.avatar,
|
||||||
"banner": change.banner,
|
"banner": change.banner,
|
||||||
@ -483,6 +483,21 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
'reorderClasses': function(newOrder) {
|
||||||
|
var current = Meteor.user().profile;
|
||||||
|
if(newOrder.every(elem => _.contains(current.classes, elem))) {
|
||||||
|
current.classes = newOrder;
|
||||||
|
Meteor.users.update({
|
||||||
|
_id: Meteor.userId()
|
||||||
|
}, {
|
||||||
|
$set: {
|
||||||
|
profile: current
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw new Meteor.Error("unauthorized", "You are not authorized to complete this action.");
|
||||||
|
}
|
||||||
|
},
|
||||||
'createProfile': function(userId) {
|
'createProfile': function(userId) {
|
||||||
var current = Meteor.users.findOne({
|
var current = Meteor.users.findOne({
|
||||||
_id: userId
|
_id: userId
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user