Skip to content
Snippets Groups Projects
Commit 8aa6bdbf authored by Björn Brala's avatar Björn Brala
Browse files

feat: for projects with real version numbers also do the prefix check so 2.1...

feat: for projects with real version numbers also do the prefix check so 2.1 -> 8.x-2.1 is also found. Fixes: #3435972
parent f33b54be
Branches
No related tags found
No related merge requests found
Pipeline #153213 passed
......@@ -207,6 +207,12 @@ class Project {
);
$this->debug("Found " . count($issues) . " issues for {$this->name} {$this->version}");
$prefixes = [
'8.x-',
'9.x-',
'10.x-',
'11.x-',
];
// Look for all issues and compare field_issue_version to the version. Mostly to handle the move to dev versions.
if (count($issues) === 0 && str_contains($this->version, 'x')) {
......@@ -218,12 +224,6 @@ class Project {
['title', 'nid', 'status', 'taxonomy_vocabulary_9', 'field_issue_version']
);
$prefixes = [
'8.x-',
'9.x-',
'10.x-',
'11.x-',
];
$issues = [];
foreach ($issuesSet as $issue) {
......@@ -249,6 +249,32 @@ class Project {
}
$this->debug("Found " . count($issues) . " issues for {$this->name} with fuzzy search");
} else {
// When no .x version and direct version is found, lets try with prefixes.
$this->debug("Looking for issue for {$this->name} without version and without version ending with .x");
$issuesSet = Request::getAllPages(
"/api-d7/node.json?type=project_issue&author=" . $uid . "&field_project=" . $this->nid . '&taxonomy_vocabulary_9=' . (int) Config::getSetting('bot_tag_tid'),
['title', 'nid', 'status', 'taxonomy_vocabulary_9', 'field_issue_version']
);
$issues = [];
foreach ($issuesSet as $issue) {
if ($issue->field_issue_version == $this->version) {
$this->debug('Found with proper version ' . $issue->field_issue_version . ' == ' . $this->version);
$issues[] = $issue;
continue;
}
foreach ($prefixes as $prefix) {
if (str_starts_with(preg_replace('/-(alpha|beta|rc).*/', '', $issue->field_issue_version), $prefix . $this->version) !== FALSE) {
$this->debug('Found with proper version ' . $issue->field_issue_version . ' starts with ' . $prefix . $this->version);
$issues[] = $issue;
break;
}
}
}
$this->debug("Found " . count($issues) . " issues for {$this->name} with fuzzy search against non .x version.");
}
$issues = array_reverse($issues);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment