Problem/Motivation

In #2991207: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases, the status messages explaining the security coverage for the installed versions are kind of wordy. Let's see if we can simplify the wording for better UX.

Proposed resolution

Improve the wording of the messages.

Remaining tasks

N/A

User interface changes

String changes (screenshots needed / see #2991207: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases for "before" screeenshots).

Message screenshots

Minor 8.2. is supported, no warning. Next minor has not come out.

Before:
minor supported no warning

After:
minor supported info, after

Minor 8.1 is supported, warning. Next minor 8.2 has come out

Before:

After:
minor supported warning, after

Minor 8.0 is unsupported. 8.2 has come out

Before:

After:
minor unsupported error, after

Minor 8.8 supported based on date, no warning

Before:

After:
8.8 minor supported info, after

Minor 8.8 , supported based on date, warning because within 6 months of support being over

Before:

After:
8.8 minor supported warning, after

Minor 8.8 , not supported based on date,

Before:

After:
8.8 minor unsupported error, after

Minor 8.9 supported based on date, no warning. No warning will show based on nearness of support being over

Before:

After:
8.9 minor supported info, after

Minor 8.9, support over

Before:

After:
8.9 minor unsupported error, after

API changes

N/A; string change only

Data model changes

N/A; string change only

Release notes snippet

N/A; string change only

CommentFileSizeAuthor
#63 3110186-63.patch18.06 KBtedbow
#63 interdiff-49-63.txt607 bytestedbow
#54 3110186-54.49-again.patch18.05 KBdww
#52 other_messages.png98.69 KBtedbow
#52 3110186-make-screenshots.patch2.26 KBtedbow
#51 error-89.png22.33 KBbenjifisher
#51 info-89.png13.13 KBbenjifisher
#51 error-88.png22.31 KBbenjifisher
#51 warning-88.png22.64 KBbenjifisher
#51 info-88.png13.4 KBbenjifisher
#51 info-82.png12.75 KBbenjifisher
#51 warning-81.png21.35 KBbenjifisher
#51 error-80.png22.22 KBbenjifisher
#49 3110186-49.patch18.05 KBtedbow
#49 interdiff-47-49.txt444 bytestedbow
#47 3110186-47.patch17.9 KBtedbow
#47 interdiff-44-47.txt4.66 KBtedbow
#44 3110186-44.patch18.04 KBtedbow
#44 interdiff-43-44.txt1.65 KBtedbow
#43 3110186-43.patch17.51 KBtedbow
#43 interdiff-38-43.txt1.58 KBtedbow
#38 3110186-38.patch17.23 KBbenjifisher
#38 interdiff-32-38.txt2.1 KBbenjifisher
#32 3110186-32.patch17.51 KBbenjifisher
#32 interdiff-26-32.txt1.44 KBbenjifisher
#27 error-89.png22.44 KBbenjifisher
#27 info-89.png13.31 KBbenjifisher
#27 error-88.png22.42 KBbenjifisher
#27 warning-88.png22.73 KBbenjifisher
#27 info-88.png13.69 KBbenjifisher
#27 info-82.png12.9 KBbenjifisher
#27 warning-81.png21.49 KBbenjifisher
#27 error-80.png22.41 KBbenjifisher
#15 status-report-877.png85.12 KBbenjifisher
#16 3110186-16-test-only.patch9.17 KBbenjifisher
#17 3110186-17.patch17.51 KBbenjifisher
#23 warning-version.png27.27 KBbenjifisher
#23 error-version.png29.4 KBbenjifisher
#23 warning-88.png28.86 KBbenjifisher
#23 info-88.png19.46 KBbenjifisher
#23 error-88.png29.37 KBbenjifisher
#26 interdiff-17-26.txt4.87 KBbenjifisher
#26 3110186-26-test-only.patch9.39 KBbenjifisher
#26 3110186-26.patch17.66 KBbenjifisher
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

benjifisher’s picture

xjm’s picture

In #2991207-212: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases I wrote:

+++ b/core/modules/update/src/ProjectSecurityRequirement.php
@@ -0,0 +1,290 @@
+      if ($this->securityCoverageInfo['additional_minors_coverage'] > 0) {
+        $requirement['value'] = $this->t('Supported minor version');
+        $requirement['severity'] = $this->securityCoverageInfo['additional_minors_coverage'] > 1 ? REQUIREMENT_INFO : REQUIREMENT_WARNING;
+      }

So, logically, with the change we've made throughout the patch [to describe it as "security coverage" rather than "supported" which is a different concept]:

Should the $requirement['value'] be "Security coverage only"? when it's a warning and it's not the most recent minor? What do you think?

(Sorry in advance since this would mean another screenshot to update.)

Wanted to post that first to get a second opinion on it. I haven't reviewed the entire new patch yet. :)

@tedbow replied:

Looking at the screenshot

We already have a big heading "DRUPAL CORE SECURITY COVERAGE".
So the heading "Supported Minor Version" and "Unsupported minor version" pertains to "security coverage" only and we are not saying anything in this issue or the message dealing with bug fixes.
If we were going to add bug fixes text to this issue we would have to also update the main message text to reflect that and then do another round of UX review.

I think why this issue is "critical" is because we informing the user about "security coverage". So if I think we should only cover that issue and get this issue done as soon as possible. Displaying bug fixes info is not as critical as displaying security coverage issue so I think we should not delay this issue with related but non-critical problems.

We could maybe change it to "Covered" or "Not covered". Or we could do something else as part of reducing the amount of text. If we could say more with the header it would mean fewer sentences, maybe.

xjm’s picture

Or here's another idea. We could get rid of the first paragraph by making the $requirement['value'] header:

Covered until the release of Drupal 8.3

dww’s picture

Posted this at #2991207-220: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases, but adding it here, too:

Do we expect end users to understand semver enough to know what "minor version" means? Should we find another way to word these messages to avoid using (introducing?) that terminology on this report?

tedbow credited ckrina.

tedbow credited webchick.

tedbow’s picture

Had another UX meeting on this today. With @xjm, @webchick, @benjifisher, me, and @ckrina

Here the consensus we came to:

  1. for messages where the heading on right in the screenshots in "Supported Minor" change this to one of the following
    1. Covered until 8.3.0
    2. Covered until 2020-Feb-11 (this uses the date format that is already on updates report
    3. Covered until 2021-Feb (to keep similar to above)
  2. Remove the first paragraph of text now that heading will provide more information.
  3. Make the 2nd and 3rd paragraphs 1 paragraph
  4. We did not have time cover the text when the minor is unsupported.
    Here is the current:

    But it suggested we try to do something similar, make the heading more informative, combine the 2 & 3 paragraphs

tedbow credited shaal.

tedbow’s picture

crediting more from the UX meeting

xjm’s picture

#8 is missing one point, which was that the second sentence of the second paragraph can be eliminated by adding a link to the first sentence. Here's sample text:

Covered until 8.3.0

<a href=":url">Update to a supported minor version</a> soon to continue receiving security updates. Visit the <a href=":d_o_url">release cycle overview</a> for more information on supported releases.
xjm’s picture

Priority: Major » Critical

Since this is blocking the 8.8 backport and is a UX gate followup, bumping to critical.

benjifisher’s picture

Assigned: Unassigned » benjifisher

I am working on this.

benjifisher’s picture

FileSize
85.12 KB

I am still working on a patch for this issue, but I wanted to point out a problem caused by the decision in #12. I used my WIP and hacked Drupal.php, setting const VERSION = '8.7.7';. This is what I see on my status report:

screenshot of the status report

We now have two different links to /admin/reports/updates/update under the error "Drupal Core Update Status" (link text "Not secure! (version 8.8.2 available)" and "available updates") and one link to /admin/reports/updates under the warning "Drupal Core Security Coverage" (link text "Update to 8.8 or higher").

I think it is confusing to have links to two different tabs on the same page. I also think it is confusing to have links to the same page with different link text, but that is out of scope for this issue. (I think we already have an issue for that anyway.)


On second thought, it was even worse before the decision in #12, since then we had the same link text ("available updates") going to two different tabs ("Available updates" and "Update").

I would like to change the link so that it goes to the same place (Update tab) as the links under "Drupal Core Update Status". Is that in scope for this issue?

benjifisher’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
9.17 KB

Here is a test-only patch. Watch me fail!

I copied the "after" screenshots from #2991207: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases into the "User interface changes" section of the issue summary for use as the "before" screenshots.

I am still doing some code cleanup, and then I will have to add "after" screenshots.

benjifisher’s picture

Assigned: benjifisher » Unassigned
FileSize
17.51 KB

Here is the full patch, and the testbot is not quite done with the test-only patch.

I still need to add some screenshots. I am not sure when I will have time for that, so I will un-assign myself.

The last submitted patch, 16: 3110186-16-test-only.patch, failed testing. View results

tedbow’s picture

@benjifisher thanks for the patch and the comments

  1. re #15

    We now have two different links to /admin/reports/updates/update under the error "Drupal Core Update Status" (link text "Not secure! (version 8.8.2 available)" and "available updates") and one link to /admin/reports/updates under the warning "Drupal Core Security Coverage" (link text "Update to 8.8 or higher").

    I thought this feedback sounded familiar so I checked #2991207: Drupal core should inform the user of the security coverage for the site's installed minor version including final 8.x LTS releases

    Sure enough @benjifisher pointed the same thing a year ago when we were first crafting this message https://www.drupal.org/project/drupal/issues/2991207#comment-12765333

    I do not like having two links to the same page, with different link text. (Although same text, different destinations would be even worse.) Maybe make "Update to 8.6 or higher soon" plain text, not a link. Or we can just delete this line.

    So basically we had already considered the suggestion in #12 in making the message in first place but decided against it for this reason. I would be in favor of not doing #12

xjm’s picture

Okay, can we have a prototype that retains the extra sentence from 12, to prevent future arguing about it? The original sentence has the same message.

Also we need to not make assumptions about what other update messages the users might be seing.

dww’s picture

Another reason not to link to /admin/reports/updates/update for messages about core is that the "Update" form can't handle updating core. It just says "Manual updates required", and provides significantly less info than the "Available updates" report does for core releases. /shrug

benjifisher’s picture

Status: Needs review » Needs work

I am setting the status to NW for screenshots and for restoring the second sentence (#20).

@tedbow, thanks for looking up that comment. At least I am consistent!

benjifisher’s picture

FileSize
27.27 KB
29.4 KB
28.86 KB
19.46 KB
29.37 KB

I am adding some screenshots.

benjifisher’s picture

Assigned: Unassigned » benjifisher

We discussed this issue at the Drupal Usability Meeting - 2020-02-20. Here is what we decided:

  1. "Drupal core security coverage" error: Change "No security updates" to "Coverage has ended"
  2. Make sure the "Visit release cycle overview" is always a sentence part and not a para (some of them looked questionable)
  3. Don't link to the update form on core update message (separate issue) because that form doesn't let you update core.
  4. Revert the change to the link target from the patch in #17. After the previous point, both the "Drupal core security coverage" and the "Drupal Core Update Status" messages on the Status report will link to the same thing.

I added #3115145: For core updates, link to list instead of update form as a follow-up issue. That takes care of point (3).

The decision in (4) removes the reason for my objection to removing the second sentence. The link text "Update to [version] or higher" in the "Drupal core security coverage" message is close enough to "Not secure! (version [version] available)" from the "Drupal Core Update Status" message that I do not think it will lead to confusion.

Re: #20. If I promise to stop arguing about it (see above) can we skip the prototype that restores the second sentence? I do not think we are doing anything that relies on the other message. We are not, for example, leaving off a link under the assumption that it will be in that message. We just want to avoid confusion in cases where both messages are present.

I am assigning this issue to myself to work on these points, and to add screenshots.

xjm’s picture

Thanks @benjifisher!

benjifisher’s picture

I think the attached patch addresses all the points raised in #24. I will let the testbot do it thing while I take screenshots.

I made one change that is out of scope:

+++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
@@ -395,8 +395,9 @@ public function testSecurityCoverageMessage($installed_version, $fixture, $requi
     // Ensure that messages are under the correct heading which could be
     // 'Checked', 'Warnings found', or 'Errors found'.
     $requirements_section_element = $requirements_details->getParent();
+    $this->assertCount(1, $requirements_section_element->findAll('css', 'h3'));
     $this->assertCount(1, $requirements_section_element->findAll('css', "h3:contains('$requirements_section_heading')"));

That is: we already check that we have the expected <h3> headers; the additional assertion is that no unexpected ones crept in. I am attaching an updated test-only patch (mostly because of the other updates to the test, not this one).

benjifisher’s picture

Issue summary: View changes
Issue tags: -Needs screenshots
FileSize
22.41 KB
21.49 KB
12.9 KB
13.69 KB
22.73 KB
22.42 KB
13.31 KB
22.44 KB

I created the screenshots by setting protected $defaultTheme = 'seven'; in the test class and then running the test. (I just double checked that I did not commit that little hack.)

Now that we have screenshots, this is really ready for review, unless the testbot disagrees.

BTW the patch in #26 removes some stray <p> tags. The comment in #24 was right that those were not just wrapping lines.

benjifisher’s picture

I am adding attribution.

The last submitted patch, 26: 3110186-26-test-only.patch, failed testing. View results

benjifisher’s picture

Assigned: benjifisher » Unassigned

I forgot to unassign myself.

tedbow’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -138,11 +138,16 @@ private function getVersionEndRequirement() {
    -        $requirement['severity'] = $this->securityCoverageInfo['additional_minors_coverage'] > 1 ? REQUIREMENT_INFO : REQUIREMENT_WARNING;
    ...
    +        $requirement['severity'] = $this->securityCoverageInfo['additional_minors_coverage'] > 1
    +          ? REQUIREMENT_INFO
    +          : REQUIREMENT_WARNING;
    

    This line change is out of scope and just adds line breaks.

  2. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -181,9 +185,9 @@ private function getVersionEndCoverageMessage() {
    +    $message = ltrim("$message ") . $this->getReleaseCycleLink();
    
    @@ -212,35 +216,36 @@ private function getDateEndRequirement() {
    +    $description = ltrim("$description ") . $this->getReleaseCycleLink();
    

    It took a second for me figure out why ltrim() was being used here. It seems hard to read because the visible space is on the right.

    I realize now it is because it will trim to an empty string if the string is empty otherwise it will put a space between the 2 string.

    I am guessing if it was hard for me to figure out it would be hard for others.

    To me this would be easier to read
    $message .= ($message ? ' ' : '') . $this->getReleaseCycleLink();

    I checked and I only found pattern is only used 1 once(but it might be hard to find)

Sorry I have finished reviewing but didn't want to lose this

benjifisher’s picture

Status: Needs work » Needs review
FileSize
1.44 KB
17.51 KB

I reverted the out-of-scope change aimed at keeping code lines to 80 characters or less.

I used the ltrim("$var ") pattern twice. The attached patch replaces both with a ternary expression, as suggested in #31.2.

I considered making the two functions where ltrim() was used more consistent by changing the variable names to be consistent. I guess that is also out of scope for this issue.

xjm’s picture

+++ b/core/modules/update/src/ProjectSecurityRequirement.php
@@ -138,11 +138,16 @@ private function getVersionEndRequirement() {
-        $requirement['value'] = $this->t('Unsupported minor version');
+        $requirement['value'] = $this->t('Coverage has ended');

I wonder if we should say "Coverage ending soon" or something like that in the warning case? (If we did that, it might be a case for making the LTS message a warning starting in May 2021 as @tedbow had mentioned earlier despite it still being a bugfix-supported releases. I could go either way on that, though.)

Ignore my suggestion here; it's less detailed in all but one case. I should have looked at the screenshots first. :)

xjm’s picture

Assigned: Unassigned » tedbow

Ted is still working on his review for this patch, so assigning accordingly.

dww’s picture

Mostly looks great. Definitely an improvement for the UI!

A few tiny questions on the tests:

  1. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -395,8 +395,9 @@ public function testSecurityCoverageMessage($installed_version, $fixture, $requi
    +    $this->assertCount(1, $requirements_section_element->findAll('css', 'h3'));
         $this->assertCount(1, $requirements_section_element->findAll('css', "h3:contains('$requirements_section_heading')"));
    

    Do we want/need both of these?

  2. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -421,7 +422,7 @@ public function testSecurityCoverageMessage($installed_version, $fixture, $requi
    +    $coverage_ended_message = 'Coverage has ended';
    
    @@ -482,7 +483,7 @@ public function securityCoverageMessageProvider() {
    +        'message' => "$coverage_ended_message $update_asap_message $release_coverage_message",
    

    Do we actually want $coverage_ended_message as a local variable? All the other assertions include the title of the warning/error as human-readable text at the start of each 'message' declaration. Maybe we should re-use that pattern for the few cases we test coverage ended? The string literal takes 5 fewer chars to write, too. ;)

  3. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -429,35 +430,35 @@ public function securityCoverageMessageProvider() {
    -        'message' => "The installed minor version of Drupal (8.1), will stop receiving official security support after the release of 8.3.0.Update to 8.2 or higher soon to continue receiving security updates. $see_available_message$release_coverage_message",
    +        'message' => "Covered until 8.3.0 Update to 8.2 or higher soon to continue receiving security updates. $release_coverage_message",
    

    Jah be praised! Since there are no longer multiple <p> we no longer need the weirdness of $see_available_message$release_coverage_message and friends. Huzzah! :)

benjifisher’s picture

@dww:

  • 35.1: I explained my reason in #26. If that is not worth testing, then I can remove that line.
  • 35.2: The other messages are not identical. If you think it is substantially clearer to be more explicit and less DRY, then I can change it. Mostly, I am afraid that the next Usability meeting will require me to change the text again, and I want to do it in one place. ;)
  • 35.3: Woot!
tedbow’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -212,35 +214,36 @@ private function getDateEndRequirement() {
    -    $security_coverage_end_timestamp = \DateTime::createFromFormat('Y-m-d', $full_security_coverage_end_date)->getTimestamp();
    ...
    +      $security_coverage_end_timestamp
    +        = \DateTime::createFromFormat('Y-m-d', $full_security_coverage_end_date)
    +          ->getTimestamp();
    

    This line was just move but then line breaks were add. I know that it was indented and makes it more over 80 but I think we should change as little as we can. I don't think this breaks are needed for readability.

  2. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -212,35 +214,36 @@ private function getDateEndRequirement() {
    -    $comparable_request_date = $date_formatter->format($time->getRequestTime(), 'custom', $date_format);
    ...
    +    $comparable_request_date = $date_formatter
    +      ->format($time->getRequestTime(), 'custom', $date_format);
    

    This line change is out of scope

  3. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -395,8 +395,9 @@ public function testSecurityCoverageMessage($installed_version, $fixture, $requi
    +    $this->assertCount(1, $requirements_section_element->findAll('css', 'h3'));
    

    This may be worth testing but it is out of scope here.

  4. +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php
    @@ -421,7 +422,7 @@ public function testSecurityCoverageMessage($installed_version, $fixture, $requi
    +    $coverage_ended_message = 'Coverage has ended';
    

    re #35.2 I agree with @benjifisher that we should add the variable to keep it similar to how we are handling other messages that are always the same.

benjifisher’s picture

Assigned: tedbow » Unassigned
Status: Needs work » Needs review
FileSize
2.1 KB
17.23 KB

@tedbow, thanks for the review!

Personally, I feel that it should be in scope to improve compliance with coding standards when moving lines around, but I will not fight about it here.

The attached patch makes the changes requested in #37. In particular (#37.4) I did not make the change requested in #35.2. I think we have a majority agreement on that point but not a consensus. Maybe that is good enough for such a minor point.

tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. RTBC 🎉

xjm’s picture

This looks good; only one comment:

  1. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -181,9 +183,9 @@ private function getVersionEndCoverageMessage() {
    -    return Markup::create($message);
    +    return Markup::create("<p>$message</p>");
    

    At one point we were requiring every Markup::create() call to include a comment explaining why any variable in it was already sanitized and known safe, to avoid contrib/custom code copying the pattern and introducing XSS. It looks like not all usages follow that anymore, but plenty of the non-test usages still do, so we should still include said comment here. The comment would be:

    $message is the concatenation of hardcoded translated strings that have already been sanitized by $this->t(), so using Markup::create() is safe.
    

    This is technically not in scope I guess since this went into HEAD already with the previous version, so a followup would be OK too, but I'd prefer it here since it's a security consideration.

  2. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -212,35 +214,33 @@ private function getDateEndRequirement() {
    +    $requirement['description'] = Markup::create("<p>$description</p>");
    

    As above. Reflecting, I'm actually a little concerned that the string generation is so far removed from the Markup::create() for getReleaseCycleLink() (so it would be theoretically possible for user input to be introduced in that method without considering the impact on this one). Maybe a followup in that case.

xjm’s picture

Issue tags: +Needs followup
xjm’s picture

Assigned: Unassigned » tedbow
Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs followup

Discussed with @tedbow. Since these are the only two usages of Markup::create() in the update module anyway, we will address it here by converting to a render array and adding the strings to the render array elements, rather than passing around and concatenating variables.

Reference: https://www.drupal.org/node/2296163

tedbow’s picture

Assigned: tedbow » Unassigned
Status: Needs work » Needs review
FileSize
1.58 KB
17.51 KB

rather than passing around and concatenating variables.

I still think it makes sense to assign to variables because they may or may not be set.

tedbow’s picture

  1. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -183,9 +183,9 @@ private function getVersionEndCoverageMessage() {
    +      '#markup' => '<p>' . ($message ? ' ' : '') . $this->getReleaseCycleLink() . '</p>',
    
    @@ -239,8 +239,9 @@ private function getDateEndRequirement() {
    +      '#markup' => '<p>' . ($description ? ' ' : '') . $this->getReleaseCycleLink() . '</p>',
    

    These actually don't print $message or $description.

  2. Talk to @xjm about this we should be concatenating via multiple render array elements
  3. Also we don't actually need the <p> tags anymore that is not 2 paragraphs. I checked other status messages and they don't use them
tim.plunkett’s picture

  1. +++ b/core/lib/Drupal.php
    @@ -82,7 +82,7 @@ class Drupal {
    -  const VERSION = '8.9.0-dev';
    +  const VERSION = '8.7.11';
    

    Local cruft?

  2. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -183,9 +183,17 @@ private function getVersionEndCoverageMessage() {
    +    return $render_array;
    +
       }
    

    Nit, only since you have to post a new patch: blank line

Otherwise, looks good to me.

xjm’s picture

Status: Needs review » Needs work

I also recommended in Slack that the render array be initialized first and the strings added to it directly, rather than creating variables and adding them at the end.

tedbow’s picture

Status: Needs work » Needs review
FileSize
4.66 KB
17.9 KB

#45 fixed

#46 Fix to use the separate string vars but the render array doesn't need to initialized first because we are adding a new key regardless

The last submitted patch, 44: 3110186-44.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

unused use statement

tim.plunkett’s picture

Patch looks great, I think this deserves some screenshots (which also would serve as manual testing).

benjifisher’s picture

Issue summary: View changes
Issue tags: -Needs screenshots
FileSize
22.22 KB
21.35 KB
12.75 KB
13.4 KB
22.64 KB
22.31 KB
13.13 KB
22.33 KB

I am updating the screenshots. I am using the same trick as in #27: setting $defaultTheme = 'seven' and running the automated test, so I am removing the "Needs screenshots" tag but leaving "Needs manual testing" for now.

tedbow’s picture

Here are the latest screenshots. @benjifisher beat me to it.

  1. The only difference you will see with previous ones that were just in the summary is there is not space on the right side that was caused by the <p> tags. This is not more like all the other messages.
    Here is example with the message next to other messages.

    Only local images are allowed.
    You can see none have the space.

  2. If anyone is interested in doing their own manual test you can either follow the instructions in the issue summary or I am also including a patch with the changes I made to make these screenshots
    It does the following
    • changes the test to a javascript test so you can see the browser
    • makes the test use Seven theme
    • pauses the test on the screen with the message(just close the browser, the test will end and fail )
    • change \Drupal\Tests\update\Functional\UpdateCoreTest::securityCoverageMessageProvider() only return the 1 case I want to look at

I don't think need Manual Testing now

tim.plunkett’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks to both of you! I think this is ready to go

dww’s picture

Bot is confused by the 3110186-make-screenshots_0.patch from #52. Re-uploading exactly #49 so the RTBC re-testing stuff is happening on the last patch in the issue.

dww’s picture

p.s. Re: #38:

I did not make the change requested in #35.2. I think we have a majority agreement on that point but not a consensus. Maybe that is good enough for such a minor point.

#35.2 Was only a question and a "Maybe we should..." suggestion. I'm totally fine with the majority agreement on keeping it as it was. Let's call it consensus after all. ;)

Thanks,
-Derek

xjm’s picture

Notes from a final review that are probably non-blocking, but I want to document them before I inspect the patch locally.

  1. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -152,8 +154,8 @@ private function getVersionEndRequirement() {
    +   * @return array
    

    This can be array[] at least, or even array[][] maybe, right? We should almost never use array as a typehint; something more specific is always possible.

  2. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -161,29 +163,34 @@ private function getVersionEndCoverageMessage() {
    +    $message['release_cycle_link'] = [
    +      '#markup' => $this->getReleaseCycleLink(),
    +    ];
    +    return $message;
    
    @@ -212,35 +219,37 @@ private function getDateEndRequirement() {
    -    $requirement['description'] = Markup::create($requirement['description'] . $this->getReleaseCycleLink());
    +    $requirement['description']['release_cycle_link'] = ['#markup' => $this->getReleaseCycleLink()];
    

    Ideally this would have an inline comment documenting that getReleaseCycleLink() returns a hardcoded translated string.

    I'm also wondering if we couldnt factor it differently so that we don't need the method at all?

  3. +++ b/core/modules/update/src/ProjectSecurityRequirement.php
    @@ -212,35 +219,37 @@ private function getDateEndRequirement() {
    +      $security_coverage_end_timestamp = \DateTime::createFromFormat('Y-m-d', $full_security_coverage_end_date)->getTimestamp();
    +      $output_date_format = $date_format === 'Y-m-d' ? 'Y-M-d' : 'Y-M';
    +      $formatted_end_date = $date_formatter
    +        ->format($security_coverage_end_timestamp, 'custom', $output_date_format);
    +      $translation_arguments = ['@date' => $formatted_end_date];
    +      $requirement['value'] = $this->t('Covered until @date', $translation_arguments);
    

    I'm wondering about whether this way of including a date is actually sufficient for translators. In order to translate to their date format, they would need to reverse-engineer the @date back to a unicode timestamp, then output in their own date format. (I know we borrowed this particular date structure from a different status report so this is probably not blocking, but I'm going to ask @Gábor Hojtsy about it.

Gábor Hojtsy’s picture

When a 'custom' date format is used, that is not at all translated. A named date format (one that has a corresponding config entity) would be translated. See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%...

string $type:
(optional) The format to use, one of:

  • One of the built-in formats: 'short', 'medium',
    'long', 'html_datetime', 'html_date', 'html_time',
    'html_yearless_date', 'html_week', 'html_month', 'html_year'.
  • The name of a date type defined by a date format config entity.
  • The machine name of an administrator-defined date format.
  • 'custom', to use $format.

Defaults to 'medium'.

I don't think you would want to use any of the html_* formats as those are for dates that go direct into markup (eg. HTML attributes) and should not be translated. I don't think any of the other three formats match what you want here. So translatability would need new named date formats (shipped date format config entities) for these purposes here.

Whether that is in the scope of this issue or not would be a release manager question probably :)

xjm’s picture

Issue tags: +Needs followup

Thanks @Gábor Hojtsy! I think it is not in scope here; it was feedback of mine on the original issue that never got addressed. I feel strongly that we should allow translators to translate dates into their calendar even if they don't use the Gregorian calendar. I remember that @tedbow was concerned that translators might make the date more specific than it's supposed to be, but I think that's preferable to imposing a foreign calendar on people. That said, it's out of scope here and only shown to administrators, so it's less bad than other places where the wrong date format might be used.

After reviewing locally, #57.2 is also out of scope because this was another thing that was added in the original issue. I think there's some refactoring that should maybe be done, but that also would be a followup.

Gábor Hojtsy’s picture

xjm’s picture

+++ b/core/modules/update/src/ProjectSecurityRequirement.php
@@ -152,8 +154,8 @@ private function getVersionEndRequirement() {
-   * @return string|\Drupal\Component\Render\MarkupInterface
-   *   The security coverage message, or an empty string if there is none.
+   * @return array
+   *   A render array containing security coverage message.
    *
    * @see \Drupal\update\ProjectSecurityData::getCoverageInfo()
    */
@@ -161,29 +163,34 @@ private function getVersionEndCoverageMessage() {

@@ -161,29 +163,34 @@ private function getVersionEndCoverageMessage() {
     if ($this->securityCoverageInfo['additional_minors_coverage'] > 0) {
       // If the installed minor version will receive security coverage until
       // newer minor versions are released, inform the user.
-      $translation_arguments = [
-        '@project' => $this->projectTitle,
-        '@version' => $this->existingMajorMinorVersion,
-        '@coverage_version' => $this->securityCoverageInfo['security_coverage_end_version'],
-      ];
-      $message = '<p>' . $this->t('The installed minor version of @project (@version), will stop receiving official security support after the release of @coverage_version.', $translation_arguments) . '</p>';
-
       if ($this->securityCoverageInfo['additional_minors_coverage'] === 1) {
         // If the installed minor version will only receive security coverage
         // for 1 newer minor core version, encourage the site owner to update
         // soon.
-        $message .= '<p>' . $this->t('Update to @next_minor or higher soon to continue receiving security updates.', ['@next_minor' => $this->nextMajorMinorVersion])
-          . ' ' . static::getAvailableUpdatesMessage() . '</p>';
+        $message['coverage_message'] = [
+          '#markup' => $this->t(
+            '<a href=":update_status_report">Update to @next_minor or higher</a> soon to continue receiving security updates.',
+            [
+              ':update_status_report' => Url::fromRoute('update.status')->toString(),
+              '@next_minor' => $this->nextMajorMinorVersion,
+            ]
+          ),
+          '#suffix' => ' ',
+        ];
       }
     }
     else {
       // Because the current minor version no longer has security coverage,
       // advise the site owner to update.
-      $message = $this->getVersionNoSecurityCoverageMessage();
+      $message['coverage_message'] = [
+        '#markup' => $this->getVersionNoSecurityCoverageMessage(),
+        '#suffix' => ' ',
+      ];
     }
-    $message .= $this->getReleaseCycleLink();
-
-    return Markup::create($message);
+    $message['release_cycle_link'] = [
+      '#markup' => $this->getReleaseCycleLink(),
+    ];
+    return $message;

This is returning a render array, as it says. Render arrays are basically always array[] for one or more levels of nesting.

benjifisher’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs followup

I added #3117157: Refactor Drupal\update\ProjectSecurityRequirement to remove methods returning string to address #56.2 (referred to as #57.2 in #58). I am removing the "needs followup" tag and setting the status to NW for #56.1.

In the follow-up issue, I suggested refactoring/removing both getVersionNoSecurityCoverageMessage() and getReleaseCycleLink(). I hope that is OK, and that my proposed resolution is in line with what you had in mind.

xjm’s picture

Perfect, thanks @benjifisher!

tedbow’s picture

Status: Needs work » Needs review
FileSize
607 bytes
18.06 KB

So here is the fix for #56.1

benjifisher’s picture

I checked the patch in #63, and it does what it is supposed to do. I would set the status to RTBC, but I contributed earlier patches to this issue.

A warning to anyone else who wants to check this: the interdiff utility gets confused when comparing the patches in #49 and #63. If you look at a diff (not interdiff) between the two patches, you will see just the change in @tedbow's interdiff-49-63.txt and a bunch of changed line numbers.

dww’s picture

Status: Needs review » Reviewed & tested by the community

#63 Solves #56.1.
#56.2 is at #3117157: Refactor Drupal\update\ProjectSecurityRequirement to remove methods returning string
#56.3 is at #3117120: Project update related date formats are not properly localisable

So that's everything since the last RTBC. I did another review and I don't see anything to complain about (which is rare). ;)

Bot is happy. No CS warnings. Back to RTBC.

Thanks, all!
-Derek

  • Gábor Hojtsy committed d1bf7d2 on 9.0.x
    Issue #3110186 by benjifisher, tedbow, dww, xjm, tim.plunkett, Gábor...

  • Gábor Hojtsy committed ca93e60 on 8.9.x
    Issue #3110186 by benjifisher, tedbow, dww, xjm, tim.plunkett, Gábor...

  • Gábor Hojtsy committed 5e387dc on 8.8.x
    Issue #3110186 by benjifisher, tedbow, dww, xjm, tim.plunkett, Gábor...
Gábor Hojtsy’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Fixed

Yay thanks all! Let's start this issue domino and see where we end :D

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.