We do a bunch of work flipping an enabled check box to be stored as a disabled flag. Let's align the MenuLinkContent entity with others in core and just use a status field that's 1 for enabled, and 0 for disabled.

Comments

pwolanin’s picture

pwolanin’s picture

Status: Postponed » Active
pwolanin’s picture

Title: MenuLinkContent disabled field should be renamed to status and use positive logic » MenuLinkContent disabled field should be renamed to enabled and use positive logic

per YesCT, let's make the field name make sense with a boolean value, and using enabled means fewer form changes

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new28.36 KB

Starting conversion - still some fails.

Status: Needs review » Needs work

The last submitted patch, 4: 2305707-4.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new2.03 KB
new30.53 KB

This should fix MenuTreeStorageTest.

cilefen’s picture

Status: Needs review » Needs work
cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new2.64 KB
new32.98 KB

A few more fixes... but I have to stop for now.

The last submitted patch, 6: 2305707-6.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 8: 2305707-8.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new829 bytes
new33.7 KB

Status: Needs review » Needs work

The last submitted patch, 11: 2305707-11.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB
new34.08 KB

Status: Needs review » Needs work

The last submitted patch, 13: 2305707-13.patch, failed testing.

pwolanin’s picture

re:

-    $edit['enabled'] = FALSE;
+    $edit['enabled[value]'] = 0;

I think the test code wants you to use TRUE or FALSE.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.66 KB
new34.09 KB
dawehner’s picture

+++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php
@@ -124,7 +124,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
+      '#default_value' => $this->menuLink->isEnabled(),

I wonder whether we considered to use status? At least this is what config entities and node use.

Status: Needs review » Needs work

The last submitted patch, 16: 2305707-16.patch, failed testing.

pwolanin’s picture

@dawehner - YesCT argued that "status" is a confusing field name if we do not define constants like NODE_PUBLISHED

In contrast, "enabled" being 1 or 0 is evident without any constant - as is "hidden" currently.

cilefen’s picture

From at least #4 on there is a regression that displays the filter tips menu to anonymous users. It is this path:

filter.tips_all:
  path: '/filter/tips'
  defaults:
    _content: '\Drupal\filter\Controller\FilterController::filterTips'
    _title: 'Compose tips'
  requirements:
    _access: 'TRUE'
cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new5.73 KB
new34.1 KB

Renamed MenuTreeParameters::onyEnabledLinks to onlyEnabledLinks. I assume that was a typo.

Status: Needs review » Needs work

The last submitted patch, 21: 2305707-21.patch, failed testing.

pwolanin’s picture

@cilefen - I'm confused about #20 - nothing in the patch should be affecting actual access

cilefen’s picture

@pwolanin - yet there it is. Test it manually and see what I mean.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB
new36.1 KB

Fixed the failures as well as the problem mentioned by @cliefen.

On top of that I had a quick scan through the patch and could not find anything problematic.

pwolanin’s picture

StatusFileSize
new36.88 KB
new825 bytes

re-roll for a moved file and fix the standard profile too (not sure why that's not causing a test fail - it used to)

The last submitted patch, 25: menu_links-2305707-25.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 26: 2305707-26.patch, failed testing.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new38.07 KB
new1.48 KB

Small fixes, solve the test fails locally

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I just fixed a tiny little detail of the tests.

This is a huge improvement because having to revert the logic all over the place is just a bad idea in general and could lead
easily to problems.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Needs a reroll

 git ac https://www.drupal.org/files/issues/2305707-29.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38984  100 38984    0     0  61153      0 --:--:-- --:--:-- --:--:-- 66753
error: patch failed: core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php:311
error: core/modules/system/src/Tests/Menu/MenuTreeStorageTest.php: patch does not apply
linl’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new37.35 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 32: 2305707-32.patch, failed testing.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new37.35 KB

Here's my reroll. fixed conflicts for 2 different core commits - form state object and the test change.

pwolanin’s picture

Status: Needs review » Reviewed & tested by the community

No changes since #30 except resolving small conflicts, so I think this can be back to rtbc

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 34: 2305707-32.patch, failed testing.

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new37.36 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new37.36 KB

Rerolled. FieldDefinition => baseFieldDefinition.

alexpott’s picture

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

Committed 4ae3ee3 and pushed to 8.0.x. Thanks!

diff --git a/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php b/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php
index d2add36..4222541 100644
--- a/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/MenuTreeParametersTest.php
@@ -119,7 +119,7 @@ public function testAddCondition() {
    *
    * @covers ::onlyEnabledLinks
    */
-  public function testExcludeDisabledLinks() {
+  public function testOnlyEnabledLinks() {
     $parameters = new MenuTreeParameters();
     $parameters->onlyEnabledLinks();
     $this->assertEquals(1, $parameters->conditions['enabled']);

Change test method name on commit.

  • alexpott committed 4ae3ee3 on 8.0.x
    Issue #2305707 by cilefen, pwolanin, dawehner, LinL: MenuLinkContent...

Status: Fixed » Closed (fixed)

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