diff --git a/controllers/dashboard.php b/controllers/dashboard.php index f27c3632637f44d5bd11d0bc26570d4f66cc254e..775e77c569f1747a19d5c199ed2f3de7a981fbcd 100644 --- a/controllers/dashboard.php +++ b/controllers/dashboard.php @@ -138,10 +138,7 @@ final class DashboardController extends TracToGitlab\Controller }); return array_map(function ($issue) { - $mrs = []; - if ($issue['merge_requests_count'] > 0) { - $mrs = $this->gitlab->issues()->relatedMergeRequests($this->gitlabProjectId, $issue['iid']); - } + $mrs = $this->gitlab->issues()->relatedMergeRequests($this->gitlabProjectId, $issue['iid']); return new TracToGitlab\GitlabIssue($issue, $mrs); }, $issues); } diff --git a/lib/GitlabIssue.php b/lib/GitlabIssue.php index 1b1e7bf743cf8d56a1a80ef3a20d8b4606892d34..9571ec2085f05966a92b12e02d3bf937a4ee2e5c 100644 --- a/lib/GitlabIssue.php +++ b/lib/GitlabIssue.php @@ -59,10 +59,9 @@ final class GitlabIssue implements \JsonSerializable public function isMerged() { - return $this->hasMergeRequests() - && count(array_filter($this->mrs, function ($mr) { - return $mr['state'] !== 'merged'; - })) === 0; + return count(array_filter($this->mrs, function ($mr) { + return $mr['state'] !== 'merged'; + })) === 0; } public function isBiest() @@ -116,7 +115,7 @@ final class GitlabIssue implements \JsonSerializable 'assignee' => $this->assignee, 'web_url' => $this->web_url, 'closed' => $this->isClosed(), - 'merge_requests' => $this->issue['merge_requests_count'], + 'merge_requests' => count($this->mrs), 'merged' => $this->isMerged(), 'qm_states' => array_combine( array_values(self::QM_LABEL_MAPPING),