Skip to content
Snippets Groups Projects
Verified Commit a6797350 authored by Jess's avatar Jess
Browse files

Issue #3279279 by phenaproxima, dww, tedbow: Remove "Download" link from Available Updates report

(cherry picked from commit 71f0e1de)
parent 0fcc3a07
Branches
Tags
24 merge requests!8506Draft: Issue #3456536 by ibrahim tameme,!5646Issue #3350972 by nod_: [random test failure]...,!5600Issue #3350972 by nod_: [random test failure]...,!5343Issue #3305066 by quietone, Rename RedirectLeadingSlashesSubscriber,!4350Issue #3307718: Implement xxHash for non-cryptographic use-cases,!3603#ISSUE 3346218 Add a different message on edit comment,!3555Issue #2473873: Views entity operations lack cacheability support, resulting in incorrect dropbuttons,!3494Issue #3327018 by Spokje, longwave, xjm, mondrake: Update PHPStan to 1.9.3 and...,!3410Issue #3340128: UserLoginForm::submitForm has some dead code,!3389Issue #3325184 by Spokje, andypost, xjm, smustgrave: $this->configFactory is...,!3381Issue #3332363: Refactor Claro's menus-and-lists stylesheet,!3307Issue #3326193: CKEditor 5 can grow past the viewport when there is a lot of content,!3236Issue #3332419: Refactor Claro's messages stylesheet,!3231Draft: Issue #3049525 by longwave, fougere, larowlan, kim.pepper, AaronBauman, Wim...,!3212Issue #3294003: Refactor Claro's entity-meta stylesheet,!3194Issue #3330981: Fix PHPStan L1 error "Relying on entity queries to check access by default is deprecated...",!3143Issue #3313342: [PHP 8.1] Deprecated function: strpos(): Passing null to parameter #1 LayoutBuilderUiCacheContext.php on line 28,!3024Issue #3307509: Empty option for views bulk form,!2972Issue #1845004: Replace custom password hashing library with PHP 5.5 password_hash(),!2719Issue #3110137: Remove Classy from core.,!2688Issue #3261452: [PP-1] Remove tracker module from core,!2437Issue #3238257 by hooroomoo, Wim Leers: Fragment link pointing to <textarea>...,!2296Issue #3100732: Allow specifying `meta` data on JSON:API objects,!1626Issue #3256642: Make life better for database drivers that extend another database driver
......@@ -34,11 +34,6 @@
</div>
<div class="layout-column layout-column--half">
<ul class="project-update__version-links">
{% if version.core_compatible is not defined or version.core_compatible %}
<li class="project-update__download-link">
<a href="{{ version.download_link }}">{{ 'Download'|t }}</a>
</li>
{% endif %}
<li class="project-update__release-notes-link">
<a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a>
</li>
......
......@@ -876,25 +876,18 @@ protected function assertCoreCompatibilityMessage(string $version, string $expec
$this->assertStringContainsString("Requires Drupal core: $expected_range", $compatibility_details->getText());
$details_summary_element = $compatibility_details->find('css', 'summary');
if ($is_compatible) {
$download_version = str_replace('.', '-', $version);
// If an update is compatible with the installed version of Drupal core,
// it should have a download link and the details element should be closed
// by default.
// the details element should be closed by default.
$this->assertFalse($compatibility_details->hasAttribute('open'));
$this->assertSame('Compatible', $details_summary_element->getText());
$this->assertEquals(
"http://example.com/{$this->updateProject}-$download_version.tar.gz",
$update_element->findLink('Download')->getAttribute('href')
);
}
else {
// If an update is not compatible with the installed version of Drupal
// core, it should not have a download link and the details element should
// be open by default.
// core, the details element should be open by default.
$this->assertTrue($compatibility_details->hasAttribute('open'));
$this->assertSame('Not compatible', $details_summary_element->getText());
$this->assertFalse($update_element->hasLink('Download'));
}
$this->assertFalse($update_element->hasLink('Download'));
}
}
......@@ -156,7 +156,6 @@ public function testMajorUpdateAvailable() {
$this->standardTests();
$this->assertUpdateTableTextNotContains('Security update required!');
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('9.0.0', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString());
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('Download', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0.tar.gz"))->toString());
$this->assertUpdateTableElementContains(Link::fromTextAndUrl('Release notes', Url::fromUri("http://example.com/{$this->updateProject}-9-0-0-release"))->toString());
$this->assertUpdateTableTextNotContains('Up to date');
$this->assertUpdateTableTextContains('Not supported!');
......@@ -425,16 +424,6 @@ public function testUnsupportedRelease() {
}
}
/**
* {@inheritdoc}
*/
protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) {
// Test XML files for Drupal core use '-' in the version number for the
// download link.
$download_version = str_replace('.', '-', $version);
parent::assertVersionUpdateLinks($label, $version, $download_version);
}
/**
* {@inheritdoc}
*/
......
......@@ -87,13 +87,15 @@ protected function standardTests() {
$this->assertSession()->linkByHrefExists('http://example.com/project/drupal');
$this->assertSession()->pageTextNotContains('No available releases found');
$this->assertSession()->pageTextContains('Last checked:');
// No download URLs should be present.
$this->assertSession()->responseNotContains('.tar.gz');
}
/**
* Asserts the expected security updates are displayed correctly on the page.
*
* @param string $project_path_part
* The project path part needed for the download and release links.
* The project path part needed for the release link.
* @param string[] $expected_security_releases
* The security releases, if any, that the status report should recommend.
* @param string $expected_update_message_type
......@@ -109,11 +111,7 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
$all_security_release_urls = array_map(function ($link) {
return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='-release']"));
$all_security_download_urls = array_map(function ($link) {
return $link->getAttribute('href');
}, $page->findAll('css', "$update_element_css_locator .version-security a[href$='.tar.gz']"));
if ($expected_security_releases) {
$expected_download_urls = [];
$expected_release_urls = [];
if ($expected_update_message_type === static::SECURITY_UPDATE_REQUIRED) {
$assert_session->elementTextNotContains('css', $update_element_css_locator, 'Update available');
......@@ -129,23 +127,18 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
foreach ($expected_security_releases as $expected_security_release) {
$expected_url_version = str_replace('.', '-', $expected_security_release);
$release_url = "http://example.com/$project_path_part-$expected_url_version-release";
$download_url = "http://example.com/$project_path_part-$expected_url_version.tar.gz";
$assert_session->responseNotContains("http://example.com/$project_path_part-$expected_url_version.tar.gz");
$expected_release_urls[] = $release_url;
$expected_download_urls[] = $download_url;
// Ensure the expected links are security links.
$this->assertContains($release_url, $all_security_release_urls, "Release $release_url is a security release link.");
$this->assertContains($download_url, $all_security_download_urls, "Release $download_url is a security download link.");
$assert_session->linkByHrefExists($release_url);
$assert_session->linkByHrefExists($download_url);
}
// Ensure no other links are shown as security releases.
$this->assertEquals([], array_diff($all_security_release_urls, $expected_release_urls));
$this->assertEquals([], array_diff($all_security_download_urls, $expected_download_urls));
}
else {
// Ensure there were no security links.
$this->assertEquals([], $all_security_release_urls);
$this->assertEquals([], $all_security_download_urls);
$assert_session->pageTextNotContains('Security update required!');
if ($expected_update_message_type === static::UPDATE_AVAILABLE) {
$assert_session->elementTextContains('css', $update_element_css_locator, 'Update available');
......@@ -168,18 +161,14 @@ protected function assertSecurityUpdates($project_path_part, array $expected_sec
* The label for the update.
* @param string $version
* The project version.
* @param string|null $download_version
* (optional) The version number as it appears in the download link. If
* $download_version is not provided then $version will be used.
*/
protected function assertVersionUpdateLinks($label, $version, $download_version = NULL) {
$download_version = $download_version ?? $version;
protected function assertVersionUpdateLinks($label, $version) {
$update_element = $this->findUpdateElementByLabel($label);
// In the release notes URL the periods are replaced with dashes.
$url_version = str_replace('.', '-', $version);
$this->assertEquals($update_element->findLink($version)->getAttribute('href'), "http://example.com/{$this->updateProject}-$url_version-release");
$this->assertEquals($update_element->findLink('Download')->getAttribute('href'), "http://example.com/{$this->updateProject}-$download_version.tar.gz");
$this->assertStringNotContainsString("http://example.com/{$this->updateProject}-$version.tar.gz", $update_element->getOuterHtml());
$this->assertEquals($update_element->findLink('Release notes')->getAttribute('href'), "http://example.com/{$this->updateProject}-$url_version-release");
}
......
......@@ -32,11 +32,6 @@
</div>
<div class="layout-column layout-column--half">
<ul class="project-update__version-links">
{% if version.core_compatible is not defined or version.core_compatible %}
<li class="project-update__download-link">
<a href="{{ version.download_link }}">{{ 'Download'|t }}</a>
</li>
{% endif %}
<li class="project-update__release-notes-link">
<a href="{{ version.release_link }}">{{ 'Release notes'|t }}</a>
</li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment