Commit 3c22ce4d98f464c79fdf6f300fb6a9de9165ab3a
Require id, not object, for issues.get
Work around asyncmemo only taking string as a keyCharles Lehner committed on 3/27/2016, 2:46:35 AM
Parent: ed69a5746faddfaf67c23a161fd8b8ba883b89f5
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -52,17 +52,10 @@ | ||
52 | 52 | var getIssue = asyncMemo(function (id, cb) { |
53 | 53 | var issue = {} |
54 | 54 | var issueMsg |
55 | 55 | |
56 | - if (id && id.value && id.key) { | |
57 | - var msg = id | |
58 | - id = id.key | |
59 | - gotIssueMsg(null, msg) | |
60 | - } else { | |
61 | - ssbGet(id, gotIssueMsg) | |
62 | - } | |
63 | - | |
64 | - function gotIssueMsg(err, msg) { | |
56 | + ssbGet(id, function (err, msg) { | |
57 | + msg = {key: id, value: msg} | |
65 | 58 | if (err) return cb(err) |
66 | 59 | issueMsg = msg |
67 | 60 | issue.id = msg.key |
68 | 61 | issue.author = msg.value.author |
@@ -73,9 +66,9 @@ | ||
73 | 66 | if (c.project) |
74 | 67 | ssbGet(c.project, gotProjectMsg) |
75 | 68 | else |
76 | 69 | getLinks() |
77 | - } | |
70 | + }) | |
78 | 71 | |
79 | 72 | function gotProjectMsg(err, msg) { |
80 | 73 | if (err) return cb(err) |
81 | 74 | issue.projectAuthor = msg.author |
@@ -194,9 +187,11 @@ | ||
194 | 187 | pull.filter(function (msg) { |
195 | 188 | return (!opts.project || opts.project == msg.value.content.project) |
196 | 189 | && (!opts.author || opts.author == msg.value.author) |
197 | 190 | }), |
198 | - paramap(getIssue, 8) | |
191 | + paramap(function (msg, cb) { | |
192 | + getIssue(msg.key, cb) | |
193 | + }, 8) | |
199 | 194 | ) |
200 | 195 | } |
201 | 196 | |
202 | 197 | function editIssue(id, opts, cb) { |
@@ -223,9 +218,9 @@ | ||
223 | 218 | try { msg = issueSchemas.new(opts.project, opts.title, opts.text) } |
224 | 219 | catch(e) { return cb(e) } |
225 | 220 | ssb.publish(msg, function (err, msg) { |
226 | 221 | if (err) return cb(err) |
227 | - getIssue(msg, cb) | |
222 | + getIssue(msg.key, cb) | |
228 | 223 | }) |
229 | 224 | } |
230 | 225 | |
231 | 226 | return { |
Built with git-ssb-web