mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
more clean-up
This commit is contained in:
parent
620572887d
commit
041c7f4ad7
4 changed files with 31 additions and 39 deletions
|
@ -85,18 +85,12 @@ nova:notifications@0.27.4-nova
|
|||
nova:posts@0.27.4-nova
|
||||
nova:rss@0.27.4-nova
|
||||
nova:search@0.27.4-nova
|
||||
nova:settings@0.27.4-nova
|
||||
nova:users@0.27.4-nova
|
||||
nova:voting@0.27.4-nova
|
||||
npm-bcrypt@0.9.2
|
||||
npm-mongo@2.2.11_2
|
||||
observe-sequence@1.0.14
|
||||
ordered-dict@1.0.9
|
||||
peerlibrary:assert@0.2.5
|
||||
peerlibrary:fiber-utils@0.6.0
|
||||
peerlibrary:reactive-mongo@0.1.1
|
||||
peerlibrary:reactive-publish@0.3.0
|
||||
peerlibrary:server-autorun@0.5.2
|
||||
percolatestudio:synced-cron@1.1.0
|
||||
promise@0.8.8
|
||||
raix:eventemitter@0.1.3
|
||||
|
@ -120,13 +114,12 @@ srp@1.0.10
|
|||
standard-minifier-css@1.3.2
|
||||
standard-minifier-js@1.2.1
|
||||
standard-minifiers@1.0.6
|
||||
std:accounts-ui@1.2.9
|
||||
std:accounts-ui@1.2.8
|
||||
tmeasday:check-npm-versions@0.3.1
|
||||
tracker@1.1.1
|
||||
ui@1.0.12
|
||||
underscore@1.0.10
|
||||
url@1.0.11
|
||||
utilities:react-list-container@0.1.14
|
||||
utilities:smart-methods@0.1.5
|
||||
webapp@1.3.12
|
||||
webapp-hashing@1.0.9
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import Posts from "meteor/nova:posts";
|
||||
import Users from 'meteor/nova:users';
|
||||
import Categories from "./collection.js";
|
||||
// import { Meteor } from 'meteor/meteor';
|
||||
// import Posts from "meteor/nova:posts";
|
||||
// import Users from 'meteor/nova:users';
|
||||
// import Categories from "./collection.js";
|
||||
|
||||
Meteor.methods({
|
||||
"categories.deleteById": function (categoryId) {
|
||||
// Meteor.methods({
|
||||
// "categories.deleteById": function (categoryId) {
|
||||
|
||||
check(categoryId, String);
|
||||
// check(categoryId, String);
|
||||
|
||||
const currentUser = this.userId && Users.findOne(this.userId);
|
||||
// const currentUser = this.userId && Users.findOne(this.userId);
|
||||
|
||||
if (Users.canDo(currentUser, "categories.remove.all")) {
|
||||
// if (Users.canDo(currentUser, "categories.remove.all")) {
|
||||
|
||||
// delete category
|
||||
Categories.remove(categoryId);
|
||||
// // delete category
|
||||
// Categories.remove(categoryId);
|
||||
|
||||
// find any direct children of this category and make them root categories
|
||||
Categories.find({parentId: categoryId}).forEach(function (category) {
|
||||
Categories.update(category._id, {$unset: {parentId: ""}});
|
||||
});
|
||||
// // find any direct children of this category and make them root categories
|
||||
// Categories.find({parentId: categoryId}).forEach(function (category) {
|
||||
// Categories.update(category._id, {$unset: {parentId: ""}});
|
||||
// });
|
||||
|
||||
// find any posts with this category and remove it
|
||||
var postsUpdated = Posts.update({categories: {$in: [categoryId]}}, {$pull: {categories: categoryId}}, {multi: true});
|
||||
// // find any posts with this category and remove it
|
||||
// var postsUpdated = Posts.update({categories: {$in: [categoryId]}}, {$pull: {categories: categoryId}}, {multi: true});
|
||||
|
||||
return postsUpdated;
|
||||
// return postsUpdated;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// assign smart methods on startup so the method code generated takes care of categories' custom fields (extended schema) -> prevent bug on create/edit categories with custom fields
|
||||
Meteor.startup(() => {
|
||||
Categories.smartMethods({
|
||||
createName: "categories.new",
|
||||
editName: "categories.edit"
|
||||
});
|
||||
});
|
||||
// // assign smart methods on startup so the method code generated takes care of categories' custom fields (extended schema) -> prevent bug on create/edit categories with custom fields
|
||||
// Meteor.startup(() => {
|
||||
// Categories.smartMethods({
|
||||
// createName: "categories.new",
|
||||
// editName: "categories.edit"
|
||||
// });
|
||||
// });
|
|
@ -11,7 +11,6 @@ Package.onUse(function (api) {
|
|||
|
||||
api.use([
|
||||
'nova:lib@0.27.4-nova',
|
||||
'nova:settings@0.27.4-nova',
|
||||
'nova:posts@0.27.4-nova',
|
||||
'nova:users@0.27.4-nova'
|
||||
]);
|
||||
|
|
|
@ -41,9 +41,9 @@ Package.onUse(function (api) {
|
|||
// 'kadira:flow-router-ssr@3.13.0',
|
||||
"reactrouter:react-router-ssr@3.1.5",
|
||||
// 'kadira:flow-router@2.12.1',
|
||||
'utilities:smart-methods@0.1.4',
|
||||
// 'utilities:smart-methods@0.1.4',
|
||||
'meteorhacks:inject-initial@1.0.4',
|
||||
'peerlibrary:reactive-publish@0.2.0'
|
||||
// 'peerlibrary:reactive-publish@0.2.0'
|
||||
];
|
||||
|
||||
api.use(packages);
|
||||
|
|
Loading…
Add table
Reference in a new issue