changed subscribers to list and fixed #13
This commit is contained in:
parent
4326346af5
commit
0200c0dc78
@ -22,7 +22,7 @@ classes.schema = new SimpleSchema({
|
|||||||
moderators: {type: [String], optional: true},
|
moderators: {type: [String], optional: true},
|
||||||
banned: {type: [String], optional: true},
|
banned: {type: [String], optional: true},
|
||||||
blockEdit: {type: [String], optional: true},
|
blockEdit: {type: [String], optional: true},
|
||||||
subscribers: {type: Number, optional: true}
|
subscribers: {type: [String], optional: true}
|
||||||
});
|
});
|
||||||
|
|
||||||
work.schema = new SimpleSchema({
|
work.schema = new SimpleSchema({
|
||||||
|
|||||||
@ -127,7 +127,7 @@ Meteor.methods({
|
|||||||
} else {
|
} else {
|
||||||
input.status = false;
|
input.status = false;
|
||||||
}
|
}
|
||||||
input.subscribers = 0;
|
input.subscribers = [Meteor.userId()];
|
||||||
input.admin = Meteor.userId();
|
input.admin = Meteor.userId();
|
||||||
if (input.privacy) {
|
if (input.privacy) {
|
||||||
Meteor.call('genCode', function(error, result) {
|
Meteor.call('genCode', function(error, result) {
|
||||||
@ -154,6 +154,16 @@ Meteor.methods({
|
|||||||
_id: classid
|
_id: classid
|
||||||
});
|
});
|
||||||
if (Meteor.user() !== null && found !== null && (found.admin === Meteor.user()._id || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']))) {
|
if (Meteor.user() !== null && found !== null && (found.admin === Meteor.user()._id || Roles.userIsInRole(Meteor.userId(), ['superadmin', 'admin']))) {
|
||||||
|
for (var i = 0; i < found.subscribers.length; i++) {
|
||||||
|
profile.classes.splice(index, 1);
|
||||||
|
Meteor.users.update({
|
||||||
|
_id: found.subscribers[i]
|
||||||
|
}, {
|
||||||
|
$set: {
|
||||||
|
profile: current
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
classes.remove({
|
classes.remove({
|
||||||
_id: classid
|
_id: classid
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user