Skip to content

Commit ef98862

Browse files
authored
Merge pull request #316 from weeblr/314-missing-pulls-j4
314 missing pulls j4
2 parents 7891ddc + 49db0f2 commit ef98862

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

administrator/components/com_patchtester/PatchTester/GitHub/GitHub.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,25 @@ public function getOpenIssues($user, $repo, $page = 0, $limit = 0)
211211
return $this->processResponse($this->client->get($prepared['url'], $prepared['headers']));
212212
}
213213

214+
/**
215+
* Get a list of the open pull requests for a repository.
216+
*
217+
* @param string $user The name of the owner of the GitHub repository.
218+
* @param string $repo The name of the GitHub repository.
219+
* @param integer $page The page number from which to get items.
220+
* @param integer $limit The number of items on a page.
221+
*
222+
* @return Response
223+
*
224+
* @since 3.0.0
225+
*/
226+
public function getOpenPulls($user, $repo, $page = 0, $limit = 0)
227+
{
228+
$prepared = $this->prepareRequest("/repos/$user/$repo/pulls", $page, $limit);
229+
230+
return $this->processResponse($this->client->get($prepared['url'], $prepared['headers']));
231+
}
232+
214233
/**
215234
* Get an option from the connector.
216235
*

administrator/components/com_patchtester/PatchTester/Model/PullsModel.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ public function requestFromGithub($page)
508508
// TODO - Option to configure the batch size
509509
$batchSize = 100;
510510

511-
$pullsResponse = Helper::initializeGithub()->getOpenIssues(
511+
$pullsResponse = Helper::initializeGithub()->getOpenPulls(
512512
$this->getState()->get('github_user'),
513513
$this->getState()->get('github_repo'),
514514
$page,
@@ -573,8 +573,6 @@ public function requestFromGithub($page)
573573

574574
foreach ($pulls as $pull)
575575
{
576-
if (isset($pull->pull_request))
577-
{
578576
// Check if this PR is RTC and has a `PR-` branch label
579577
$isRTC = false;
580578
$isNPM = false;
@@ -618,14 +616,13 @@ public function requestFromGithub($page)
618616
$this->getDb()->quote(
619617
HTMLHelper::_('string.truncate', $pull->body, 100)
620618
),
621-
$this->getDb()->quote($pull->pull_request->html_url),
619+
$this->getDb()->quote($pull->html_url),
622620
(int) $isRTC,
623621
(int) $isNPM,
624622
$this->getDb()->quote($branch),
625623
];
626624

627625
$data[] = implode(',', $pullData);
628-
}
629626
}
630627

631628
// If there are no pulls to insert then bail, assume we're finished

0 commit comments

Comments
 (0)