Skip to content

Commit d8199d4

Browse files
author
Michael Babker
committed
Apply patch returns false positive (Fix #69)
1 parent 11c412e commit d8199d4

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

administrator/components/com_patchtester/PatchTester/Controller/ApplyController.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ public function execute()
3333
// Initialize the state for the model
3434
$model->setState($this->initializeState($model));
3535

36-
$model->apply($this->getInput()->getUint('pull_id'));
36+
if ($model->apply($this->getInput()->getUint('pull_id')))
37+
{
38+
$msg = \JText::_('COM_PATCHTESTER_APPLY_OK');
39+
}
40+
else
41+
{
42+
$msg = \JText::_('COM_PATCHTESTER_NO_FILES_TO_PATCH');
43+
}
3744

38-
$msg = \JText::_('COM_PATCHTESTER_APPLY_OK');
3945
$type = 'message';
4046
}
4147
catch (\Exception $e)

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ public function apply($id)
164164

165165
if (!$files)
166166
{
167-
// TODO - Should be a better way to enqueue messages without needing the application...
168-
\JFactory::getApplication()->enqueueMessage(\JText::_('COM_PATCHTESTER_NO_FILES_TO_PATCH', 'message'));
169-
170-
return true;
167+
return false;
171168
}
172169

173170
foreach ($files as $file)

administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ COM_PATCHTESTER_FILTER_SEARCH_DESCRIPTION="Filter the list by title or ID."
4040
COM_PATCHTESTER_HEADING_FETCH_DATA="Fetching GitHub Data"
4141
COM_PATCHTESTER_PULL_ID="Pull ID"
4242
COM_PATCHTESTER_NO_CREDENTIALS="No user credentials are saved, this will allow only 60 requests to the GitHub API per hour. Saving user credentials will allow 5,000 requests per hour."
43+
COM_PATCHTESTER_NO_FILES_TO_PATCH="There are no files to patch from this pull request. This may mean that the files in the pull request are not present in your installation."
4344
COM_PATCHTESTER_NO_ITEMS="No data has been retrieved from GitHub, please click the 'Fetch Data' button in the toolbar to retrieve the open pull requests."
4445
COM_PATCHTESTER_NOT_APPLIED="Not Applied"
4546
COM_PATCHTESTER_GITHUB="GitHub"

0 commit comments

Comments
 (0)