Commit 28ee0655c00f29d4d71fe8f7ed7d0913771291ff
Render comments from patchwork on issues/PRs in whole thread
Charles Lehner committed on 4/13/2016, 2:11:17 AMParent: 24932ccb6a1e535b89e82f8f65f67957e0345f4d
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -990,8 +990,9 @@ | ||
990 | 990 | } |
991 | 991 | // fallthrough |
992 | 992 | case 'post': |
993 | 993 | if (ref.isMsgId(c.issue) && ref.isMsgId(c.repo)) { |
994 | + // comment on an issue | |
994 | 995 | var done = multicb({ pluck: 1, spread: true }) |
995 | 996 | getRepo(c.repo, done()) |
996 | 997 | pullReqs.get(c.issue, done()) |
997 | 998 | return done(function (err, repo, issue) { |
@@ -1002,8 +1003,33 @@ | ||
1002 | 1003 | var serve = issue.msg.value.content.type == 'pull-request' ? |
1003 | 1004 | serveRepoPullReq : serveRepoIssue |
1004 | 1005 | cb(null, serve(req, Repo(repo), issue, path, id)) |
1005 | 1006 | }) |
1007 | + } else if (ref.isMsgId(c.root)) { | |
1008 | + // comment on issue from patchwork? | |
1009 | + return getMsg(c.root, function (err, root) { | |
1010 | + if (err) return cb(null, serveError(err)) | |
1011 | + var repoId = root.content.repo || root.content.project | |
1012 | + if (!ref.isMsgId(repoId)) | |
1013 | + return cb(null, serveGenericMessage(req, id, msg, path)) | |
1014 | + getRepo(repoId, function (err, repo) { | |
1015 | + if (err) return cb(null, serveError(err)) | |
1016 | + switch (root.content && root.content.type) { | |
1017 | + case 'issue': | |
1018 | + return issues.get(c.root, function (err, issue) { | |
1019 | + if (err) return cb(null, serveError(err)) | |
1020 | + return cb(null, | |
1021 | + serveRepoIssue(req, Repo(repo), issue, path, id)) | |
1022 | + }) | |
1023 | + case 'pull-request': | |
1024 | + pullReqs.get(c.root, function (err, pr) { | |
1025 | + if (err) return cb(null, serveError(err)) | |
1026 | + return cb(null, | |
1027 | + serveRepoPullReq(req, Repo(repo), pr, path, id)) | |
1028 | + }) | |
1029 | + } | |
1030 | + }) | |
1031 | + }) | |
1006 | 1032 | } |
1007 | 1033 | // fallthrough |
1008 | 1034 | default: |
1009 | 1035 | if (ref.isMsgId(c.repo)) |
Built with git-ssb-web