Commit 0764edcc78e29358a627ab3614462f998cfdc47b
Simplify getting issue state
Charles Lehner committed on 8/2/2016, 3:00:22 AMParent: 4de55198f28a26699cb48dbe58ca2d058e0ebe88
Files changed
modules/git.js | changed |
modules/git.js | ||
---|---|---|
@@ -31,15 +31,14 @@ | ||
31 | 31 | function getIssueState(id, cb) { |
32 | 32 | pull( |
33 | 33 | sbot_links({dest: id, rel: 'issues', values: true, reverse: true}), |
34 | 34 | pull.map(function (msg) { |
35 | - var issues = msg.value.content.issues | |
36 | - if (!Array.isArray(issues)) return | |
37 | - return issues.filter(function (issue) { | |
38 | - return issue.link === id | |
39 | - }) | |
35 | + return msg.value.content.issues | |
40 | 36 | }), |
41 | 37 | pull.flatten(), |
38 | + pull.filter(function (issue) { | |
39 | + return issue.link === id | |
40 | + }), | |
42 | 41 | pull.map(function (issue) { |
43 | 42 | return issue.merged ? 'merged' : issue.open ? 'open' : 'closed' |
44 | 43 | }), |
45 | 44 | pull.take(1), |
Built with git-ssb-web