diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/serve.js b/lib/serve.js index 09f7aa3..1bf2196 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -76,7 +76,7 @@ Serve.prototype.go = function () { var auth = this.req.headers['authorization'] var tok = null //console.log('Authorization: ',auth) - + if (auth) { var a = auth.split(' ') if (a[0] == 'Basic') { @@ -3052,9 +3052,9 @@ Serve.prototype.composer = function (opts, cb) { return {name: name, id: id} }) - // strip content other than feed ids from the recps field + // strip content other than names and feed ids from the recps field if (data.recps) { - data.recps = u.extractFeedIds(data.recps).filter(uniques()).join(', ') + data.recps = recpsToFeedIds(data.recps) } var done = multicb({pluck: 1, spread: true}) @@ -3125,6 +3125,26 @@ Serve.prototype.composer = function (opts, cb) { )) done(cb) + function recpsToFeedIds (recps) { + var res = data.recps.split(',') + .map(function (str) { + str = str.trim() + var ids = u.extractFeedIds(str).filter(uniques()) + if (ids.length >= 1) { + return ids[0] + } else { + ids = u.extractFeedIds(self.app.getReverseNameSync(str)) + if (ids.length >= 1) { + return ids[0] + } else { + return null + } + } + }) + .filter(Boolean) + return res.join(', ') + } + function prepareContent(cb) { var done = multicb({pluck: 1}) content = { |