diff --git a/History.md b/History.md index c38fceff4..03b3d735e 100644 --- a/History.md +++ b/History.md @@ -1,4 +1,4 @@ -## v0.23.2 +## v0.24 “SubScope2” * [BREAKING] Modules data context must now be passed on explicitely using the `moduleData` attribute. * [BREAKING] Updated `category_title` template. @@ -22,7 +22,8 @@ * Now filtering out categories with no posts from the categories menu. * Added `postDeleteAsync` callback hook. * Now publishing all public user data all the time to work around nested fields subscriptions bug. - +* Categories with same name now get different, unique slugs. +* Now getting link source name and URL from Embedly if available. ## v0.23 “SubScope” diff --git a/packages/telescope-embedly/lib/server/get_embedly_data.js b/packages/telescope-embedly/lib/server/get_embedly_data.js index 0e680aa00..21cb2ab29 100644 --- a/packages/telescope-embedly/lib/server/get_embedly_data.js +++ b/packages/telescope-embedly/lib/server/get_embedly_data.js @@ -34,7 +34,6 @@ getEmbedlyData = function (url) { } var embedlyData = _.pick(result.data, 'title', 'media', 'description', 'thumbnailUrl', 'sourceName', 'sourceUrl'); - console.log(embedlyData); return embedlyData; diff --git a/packages/telescope-tags/lib/callbacks.js b/packages/telescope-tags/lib/callbacks.js index f7438f5de..95050604e 100644 --- a/packages/telescope-tags/lib/callbacks.js +++ b/packages/telescope-tags/lib/callbacks.js @@ -21,7 +21,8 @@ Telescope.callbacks.add("postClass", addCategoryClass); // when a category is added to a post, increment counter function updateCategoryCountOnSubmit (post) { - Categories.update({_id: {$in: post.categories}}, {$inc: {"postsCount": 1}}, {multi: true}); + if (!_.isEmpty(post.categories)) + Categories.update({_id: {$in: post.categories}}, {$inc: {"postsCount": 1}}, {multi: true}); } Telescope.callbacks.add("postSubmitAsync", updateCategoryCountOnSubmit); @@ -30,8 +31,11 @@ function updateCategoryCountOnEdit (newPost, oldPost) { var categoriesAdded = _.difference(newPost.categories, oldPost.categories); var categoriesRemoved = _.difference(oldPost.categories, newPost.categories); - Categories.update({_id: {$in: categoriesAdded}}, {$inc: {"postsCount": 1}}, {multi: true}); - Categories.update({_id: {$in: categoriesRemoved}}, {$inc: {"postsCount": -1}}, {multi: true}); + if (!_.isEmpty(categoriesAdded)) + Categories.update({_id: {$in: categoriesAdded}}, {$inc: {"postsCount": 1}}, {multi: true}); + + if (!_.isEmpty(categoriesRemoved)) + Categories.update({_id: {$in: categoriesRemoved}}, {$inc: {"postsCount": -1}}, {multi: true}); } Telescope.callbacks.add("postEditAsync", updateCategoryCountOnEdit);