git ssb

0+

Kira / %V53yIAO6ZNGv1Lx9tCP…



forked from cel / ssb-issues

Commit 3c22ce4d98f464c79fdf6f300fb6a9de9165ab3a

Require id, not object, for issues.get

Work around asyncmemo only taking string as a key
Charles Lehner committed on 3/27/2016, 2:46:35 AM
Parent: ed69a5746faddfaf67c23a161fd8b8ba883b89f5

Files changed

index.jschanged
index.jsView
@@ -52,17 +52,10 @@
5252 var getIssue = asyncMemo(function (id, cb) {
5353 var issue = {}
5454 var issueMsg
5555
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}
6558 if (err) return cb(err)
6659 issueMsg = msg
6760 issue.id = msg.key
6861 issue.author = msg.value.author
@@ -73,9 +66,9 @@
7366 if (c.project)
7467 ssbGet(c.project, gotProjectMsg)
7568 else
7669 getLinks()
77- }
70+ })
7871
7972 function gotProjectMsg(err, msg) {
8073 if (err) return cb(err)
8174 issue.projectAuthor = msg.author
@@ -194,9 +187,11 @@
194187 pull.filter(function (msg) {
195188 return (!opts.project || opts.project == msg.value.content.project)
196189 && (!opts.author || opts.author == msg.value.author)
197190 }),
198- paramap(getIssue, 8)
191+ paramap(function (msg, cb) {
192+ getIssue(msg.key, cb)
193+ }, 8)
199194 )
200195 }
201196
202197 function editIssue(id, opts, cb) {
@@ -223,9 +218,9 @@
223218 try { msg = issueSchemas.new(opts.project, opts.title, opts.text) }
224219 catch(e) { return cb(e) }
225220 ssb.publish(msg, function (err, msg) {
226221 if (err) return cb(err)
227- getIssue(msg, cb)
222+ getIssue(msg.key, cb)
228223 })
229224 }
230225
231226 return {

Built with git-ssb-web