Problem/Motivation

Maintenance mode page's checkbox description shows a Permission name as "Access site in maintenance mode" which doesn't exist.

Proposed resolution

Change the permission name to the actual name as "Use the site in maintenance mode"

Remaining tasks

  1. Patch and manually test.

Comments

aneek created an issue. See original summary.

aneek’s picture

StatusFileSize
new1.41 KB

Patch to fix this.

aneek’s picture

Issue tags: +Novice
aneek’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2731861-02.patch, failed testing.

visabhishek’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Uploading the patch.

Status: Needs review » Needs work

The last submitted patch, 6: maintenance_mode-2731861-6.patch, failed testing.

aneek’s picture

Humm, this should not happen. Might be a issue with other scripts running in the CI.

rajeshwari10’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB

Given a try to apply the same patch just to see whether it get pass or not.

Thanks!!

rajeshwari10’s picture

Assigned: aneek » rajeshwari10

Given a try to apply the same patch just to see whether it get pass or not.

Thanks!!

Status: Needs review » Needs work

The last submitted patch, 9: 2731861-9.patch, failed testing.

aneek’s picture

@rajeshwari10,

diff --git a/sites/default/default.services.yml b/sites/default/default.services.yml
old mode 100644
new mode 100755
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
old mode 100644
new mode 100755

These should not come in this patch. Please remove and re-apply the patch.
Thanks!

sagar ramgade’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Patch corrected as per comment #12.

aneek’s picture

Assigned: rajeshwari10 » Unassigned
Status: Needs review » Reviewed & tested by the community
aneek’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 13: drupal-wrong_permission_maintenance_page-2731861-13-D8.patch, failed testing.

imalabya’s picture

Status: Needs work » Needs review
StatusFileSize
new1.42 KB

The description should be enclosed in $this->t() for proper translation when used in Classes. I guess this is the reason for failed tests.

Din't add an interdiff since it's just a line of code.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for providing the patch. This is indeed the right permission label

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: 2731861-17.patch, failed testing.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/src/Form/SiteMaintenanceModeForm.php
@@ -65,7 +65,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
-      '#description' => t('Visitors will only see the maintenance mode message. Only users with the "Access site in maintenance mode" <a href=":permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href=":user-login">user login</a> page.', array(':permissions-url' => $this->url('user.admin_permissions'), ':user-login' => $this->url('user.login'))),
+      '#description' => $this->t('Visitors will only see the maintenance mode message. Only users with the "Use the site in maintenance mode" <a href=":permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href=":user-login">user login</a> page.', array(':permissions-url' => $this->url('user.admin_permissions'), ':user-login' => $this->url('user.login'))),

So this is a bit more complex than this. Unfortunately. We shoudl get the translated permission name from the permissions handler so a translator does not have to keep this in sync with whatever ever they've translated the 'access site in maintenance mode' (yep that's the machine name) permission title to be.

gábor hojtsy’s picture

@alexpott asked me to look in here. IMHO we do use the pattern of looking up specific translations as well as inlining known strings like this in help text, so IMHO either works.

alauzon’s picture

Assigned: Unassigned » alauzon

I'm working on it during the Drupal North code sprint.

alauzon’s picture

StatusFileSize
new3.69 KB

Here is my patch. I did what alexpott suggested on #21:

We shoudl get the translated permission name from the permissions handler so a translator does not have to keep this in sync with whatever ever they've translated the 'access site in maintenance mode' (yep that's the machine name) permission title to be.

Please review it and accept it if it is OK.

maxocub’s picture

Status: Needs work » Needs review
Issue tags: +DrupalNorth2016

Thanks @alauzon for your first patch!
I added the DrupalNorth tag and put it in need review to trigger the tests.
Also, it is good practice to add an interdiff when you update an existing patch, that is a file showing only what changed since the previous patch. Here's a link for the doc: https://www.drupal.org/documentation/git/interdiff

Status: Needs review » Needs work

The last submitted patch, 24: 0001-2731861-21.patch, failed testing.

pashupathi nath gajawada’s picture

Assigned: alauzon » pashupathi nath gajawada
Status: Needs work » Needs review
StatusFileSize
new3.51 KB

Please finf the updated patch.

Done the modifications suggested by Alex #21,
Updated the latest patch of Alauzon #24. by updating the permission label with
$permission_label = $permissions['Use the site in maintenance mode']['title'];.

Status: Needs review » Needs work

The last submitted patch, 27: 2731861-27.patch, failed testing.

aneek’s picture

  1. Please add interdiff. HELP
  2. +++ b/core/modules/system/src/Form/SiteMaintenanceModeForm.php
    @@ -61,11 +73,13 @@ protected function getEditableConfigNames() {
    +    $permissions = $this->permissionHandler->getPermissions();
    +    $permission_label = $permissions['Use the site in maintenance mode']['title'];
    

    Where $permission_label is used?

  3. +++ b/core/modules/system/src/Form/SiteMaintenanceModeForm.php
    @@ -75,7 +89,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    + ¶
    

    Extra white space.

  4. As per CI, there are errors regarding to
    exception: [Notice] Line 77 of core/modules/system/src/Form/SiteMaintenanceModeForm.php:
    Please have a look at this.

Thanks!!

starshaped’s picture

Status: Needs work » Needs review
StatusFileSize
new3.37 KB

I believe this is actually the right patch to move this issue forward - it is essentially the patch from #24 so I haven't provided an interdiff.

Status: Needs review » Needs work

The last submitted patch, 30: maintenance_mode-2731861-30.patch, failed testing.

maxocub’s picture

Status: Needs work » Needs review
StatusFileSize
new3.3 KB
new1.11 KB

There was a typo in there:

-      '#default_value' => $this->state->get('system.maintenance_m'),
+      '#default_value' => $this->state->get('system.maintenance_mode'),

In think the tests should pass now.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Applied the patch to 8.2.x and tested. It works!

Does this need any testing?

erozqba’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs review » Reviewed & tested by the community

I have also applied the patch to 8.2.x and tested, its looks good to me and I don't think we need to add a test for this, so I'm changing the status.

erozqba’s picture

Version: 8.3.x-dev » 8.2.x-dev

Sorry, I changed the version by error.

alexpott’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests, +String change in 8.3.0

Well we broke it so adding a test might seem like good idea. This was broken in #620446: Rewrite permission titles and descriptions so these types of bugs are hard to find. We just need an assert that the permission label appears on the page. Considering we're now making the text come from the permission system I think this is worth testing.

Also string changes can only happen in 8.3.0. This is so translations have a chance to keep up.

felribeiro’s picture

Status: Needs work » Needs review
StatusFileSize
new4.81 KB
new1.37 KB

The test to assert that the permission label appears on the page.

quietone’s picture

@felribeiro, thanks for adding the test.

At first I thought the message in the assertion, "Found the permission message." was too brief. But after running the tests I see that it makes sense in context. And just one question, since $this->url is deprecated, does this need to be changed now or later?

maxocub’s picture

Assigned: pashupathi nath gajawada » Unassigned
Issue tags: -Needs tests
StatusFileSize
new5.72 KB
new4.19 KB

It's a bit out of scope I think, but since we're changing this line, why not.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

I guess that answers my question. Thank you. Looks good to me, so RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

@quietone, @maxocub you are both right - it is out-of-scope. But considering the line is changing seems ok to me.

Committed 73078ed and pushed to 8.3.x. Thanks!

  • alexpott committed 73078ed on 8.3.x
    Issue #2731861 by maxocub, felribeiro, aneek, alauzon, rajeshwari10,...
rajeshwari10’s picture

Status: Fixed » Closed (fixed)

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

maxocub’s picture