git ssb

30+

cel / git-ssb-web



Commit 28ee0655c00f29d4d71fe8f7ed7d0913771291ff

Render comments from patchwork on issues/PRs in whole thread

Charles Lehner committed on 4/13/2016, 2:11:17 AM
Parent: 24932ccb6a1e535b89e82f8f65f67957e0345f4d

Files changed

index.jschanged
index.jsView
@@ -990,8 +990,9 @@
990990 }
991991 // fallthrough
992992 case 'post':
993993 if (ref.isMsgId(c.issue) && ref.isMsgId(c.repo)) {
994+ // comment on an issue
994995 var done = multicb({ pluck: 1, spread: true })
995996 getRepo(c.repo, done())
996997 pullReqs.get(c.issue, done())
997998 return done(function (err, repo, issue) {
@@ -1002,8 +1003,33 @@
10021003 var serve = issue.msg.value.content.type == 'pull-request' ?
10031004 serveRepoPullReq : serveRepoIssue
10041005 cb(null, serve(req, Repo(repo), issue, path, id))
10051006 })
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+ })
10061032 }
10071033 // fallthrough
10081034 default:
10091035 if (ref.isMsgId(c.repo))

Built with git-ssb-web