index.jsView |
---|
684 | 684 | case 'issue-edit': |
685 | 685 | if (ref.isMsgId(c.issue)) { |
686 | 686 | return self.pullReqs.get(c.issue, function (err, issue) { |
687 | 687 | 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 |
691 | 688 | self.getRepo(issue.project, function (err, repo) { |
692 | 689 | if (err) { |
693 | 690 | if (!repo) return cb(null, |
694 | 691 | self.repos.serveRepoNotFound(req, c.repo, err)) |
695 | 692 | return cb(null, self.serveError(req, err)) |
696 | 693 | } |
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)) |
698 | 696 | }) |
699 | 697 | }) |
700 | 698 | } |
701 | 699 | |
710 | 708 | if (!repo) return cb(null, |
711 | 709 | self.repos.serveRepoNotFound(req, c.repo, err)) |
712 | 710 | return cb(null, self.serveError(req, err)) |
713 | 711 | } |
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)) |
718 | 714 | }) |
719 | 715 | } else if (ref.isMsgId(c.root)) { |
720 | 716 | |
721 | 717 | return self.getMsg(c.root, function (err, root) { |