git ssb

30+

cel / git-ssb-web



Commit cbaa9d67bdc3ff77eb179a880b36532cdcbffa7f

Fix calling method to serve issue/PR

Charles Lehner committed on 4/24/2016, 3:23:12 AM
Parent: d7ec56cfafdb55e447fea811aad69317944ece35

Files changed

index.jschanged
lib/repos/index.jschanged
index.jsView
@@ -684,18 +684,16 @@
684684 case 'issue-edit':
685685 if (ref.isMsgId(c.issue)) {
686686 return self.pullReqs.get(c.issue, function (err, issue) {
687687 if (err) return cb(err)
688- var serve = issue.msg.value.content.type == 'pull-request'
689- ? self.repos.pulls.serveRepoPullReq
690- : self.repos.issues.serveRepoIssue
691688 self.getRepo(issue.project, function (err, repo) {
692689 if (err) {
693690 if (!repo) return cb(null,
694691 self.repos.serveRepoNotFound(req, c.repo, err))
695692 return cb(null, self.serveError(req, err))
696693 }
697- cb(null, serve.call(self, req, GitRepo(repo), issue, path, id))
694+ cb(null, self.repos.serveIssueOrPullRequest(req, GitRepo(repo),
695+ issue, path, id))
698696 })
699697 })
700698 }
701699 // fallthrough
@@ -710,12 +708,10 @@
710708 if (!repo) return cb(null,
711709 self.repos.serveRepoNotFound(req, c.repo, err))
712710 return cb(null, self.serveError(req, err))
713711 }
714- var serve = issue.msg.value.content.type == 'pull-request'
715- ? self.repos.pulls.serveRepoPullReq
716- : self.repos.issues.serveRepoIssue
717- cb(null, serve.call(self, req, GitRepo(repo), issue, path, id))
712+ cb(null, self.repos.serveIssueOrPullRequest(req, GitRepo(repo),
713+ issue, path, id))
718714 })
719715 } else if (ref.isMsgId(c.root)) {
720716 // comment on issue from patchwork?
721717 return self.getMsg(c.root, function (err, root) {
lib/repos/index.jsView
@@ -935,4 +935,10 @@
935935 req._t('Cancel') + '</button>' +
936936 '</p></form>'
937937 ))
938938 }
939+
940+R.serveIssueOrPullRequest = function (req, repo, issue, path, id) {
941+ return issue.msg.value.content.type == 'pull-request'
942+ ? this.pulls.serveRepoPullReq(req, repo, issue, path, id)
943+ : this.issues.serveRepoIssue(req, repo, issue, path, id)
944+}

Built with git-ssb-web