apostrophe-snippets
Advanced tools
Comparing version 0.0.24 to 0.0.25
29
index.js
@@ -788,5 +788,5 @@ var async = require('async'); | ||
self.get = function(req, optionsArg, callback) { | ||
if (!callback) { | ||
callback = optionsArg; | ||
self.get = function(req, optionsArg, mainCallback) { | ||
if (!mainCallback) { | ||
mainCallback = optionsArg; | ||
optionsArg = {}; | ||
@@ -871,2 +871,3 @@ } | ||
if (err) { | ||
console.log(err); | ||
return callback(err); | ||
@@ -876,2 +877,20 @@ } | ||
got = snippets.length; | ||
// This is a good idea, but we need to figure out how to make sure it all | ||
// ends in a browser redirect and doesn't break blog, events or map, and | ||
// also guard against loops | ||
// | ||
// // If this all started with a slug parameter that possibly no longer | ||
// // exists, check the redirect table before giving up. If there is a redirect | ||
// // recursively invoke the whole thing | ||
// if (optionsArg.slug && (!got)) { | ||
// // Check the redirect table | ||
// return self._apos.redirects.findOne({ from: optionsArg.slug }, function(err, redirect) { | ||
// if (redirect) { | ||
// var newOptions = {}; | ||
// extend(true, newOptions, optionsArg); | ||
// newOptions.slug = redirect.to; | ||
// return self.get(req, newOptions, mainCallback); | ||
// } | ||
// }); | ||
// } | ||
return callback(err); | ||
@@ -944,5 +963,5 @@ }); | ||
if (err) { | ||
return callback(err); | ||
return mainCallback(err); | ||
} | ||
return callback(null, snippets); | ||
return mainCallback(null, snippets); | ||
} | ||
@@ -949,0 +968,0 @@ }; |
{ | ||
"name": "apostrophe-snippets", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "Reusable content snippets for the Apostrophe content management system. The blog and events modules are built on this foundation, which is also useful in and of itself.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
125542
1761