Skip to content
Snippets Groups Projects
Commit 72b62224 authored by Joël Pittet's avatar Joël Pittet Committed by Joël Pittet
Browse files

Issue #2994161 by joelpittet, webflo: Fix diff link for dev versions

parent b348430d
No related branches found
Tags 6.x-1.0-beta7
No related merge requests found
......@@ -82,11 +82,21 @@ function composer_deploy_preprocess_update_project_status(&$variables) {
$projectData = \Drupal::service('extension.list.' . $project_type)->getExtensionInfo($variables['project']['name']);
foreach ($variables['versions'] as &$version) {
/** @todo: Handle dev releases (compare to branch) */
$currentVersion = substr($variables['project']['existing_version'], -3) == 'dev' ? $projectData['composer_deploy_git_hash'] : $variables['project']['existing_version'];
$currentVersion = $variables['project']['existing_version'];
// Replace our current version with the specific hash when on -dev release.
if (substr($variables['project']['existing_version'], -3) == 'dev') {
$currentVersion = $projectData['composer_deploy_git_hash'];
}
$upstreamVersion = $version['#version']['tag'];
// When the upstream is using dev, switch to branch tag.
if (substr($version['#version']['tag'], -3) == 'dev') {
$upstreamVersion = substr($version['#version']['tag'], 0, -4);
}
// Add diff link.
$diff = Url::fromUri('https://git.drupalcode.org/project/' . $variables['project']['name'] . '/compare/' . $currentVersion . '...' . $version['#version']['tag']);
$diff = Url::fromUri('https://git.drupalcode.org/project/' . $variables['project']['name'] . '/compare/' . $currentVersion . '...' . $upstreamVersion);
$version['#version']['diff_link'] = $diff->toString();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment