Problem/Motivation

Tours should not be displayed when disabled.

Example Using Tour UI disabling a Tour by setting it's status is not respected by core Tour module. See #2073321: We need to disable | enable tours.

Steps to reproduce

Using Tour UI use https://www.drupal.org/files/issues/2018-10-07/tour_ui-2073321-3.patch
Disable a tour
Verify it still appears

If not using Tour UI
Edit a yml file by setting status to FALSE.
Import change
Verify it still appears.

Proposed resolution

Hide tour when disabled.

Remaining tasks

Testing
Patch review
Commit

User interface changes

NA

API changes

NA

Data model changes

NA

Comments

clemens.tolboom created an issue. See original summary.

clemens.tolboom’s picture

Title: Respect tour status (disabled » Respect tour status (disabled | enabled)
clemens.tolboom’s picture

Status: Active » Needs review
StatusFileSize
new2.02 KB
new2.02 KB

Hope I got it right. Pointers on how to easily local test are welcome :-(

clemens.tolboom’s picture

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

It did not fail as logic was wrong.

clemens.tolboom’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: core-tour-disable-3004897-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

ridhimaabrol24’s picture

Status: Needs work » Needs review
StatusFileSize
new1.95 KB
new2.46 KB

Rerolled patch for 9.1.x!

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

Status: Needs review » Needs work

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

ridhimaabrol24’s picture

Status: Needs work » Needs review
StatusFileSize
new2.23 KB
new2.74 KB
new1.13 KB

Fixing failed tests!

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

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

tanubansal’s picture

Patch #13, 9.1 is working fine
RTBC

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ranjith_kumar_k_u’s picture

StatusFileSize
new2.91 KB

Rerolled #13

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 20: 3004897-20.patch, failed testing. View results

clemens.tolboom’s picture

Status: Needs work » Needs review

(Not sure how to trigger a retest)

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Putting back to RTBC seems to be a random test failure. Reran and no issues.

@clemens.tolboom under the patch you can click Add test/ retrest

clemens.tolboom’s picture

Not sure how you did it ... but I guess you went through the custom flow? My UX with this is bad.

But yeah ... now Tour UI can use this :)

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs tests +Needs issue summary update

The issue summary should have a proposed resolution so reviewers and committers can check that the desired solution is implemented.

Some manual testing of this would be a good idea, as well.

I do not see a code review of any of the patches. I took a brief look.

  1. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +   * Test tour tip enable disable functionality.
    

    Tests enabling and disabling the tour tip functionality.

  2. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +  public function testEnableDisable() {
    

    Ha, the test actually tests disabled first! But if this is testing the status value then use that name, testStatus.

  3. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +    $tour->setStatus(FALSE);
    

    If it were me I would test enabled first, then disabled. That way we have some assurance that the disabling really removes the tips.

  4. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +    // Navigate to tour-test-1 and verify the tour_test_1 tip is found with appropriate classes.
    

    Wrap to 80 characters.

  5. +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
    @@ -29,8 +29,10 @@ abstract class TourTestBase extends BrowserTestBase {
    +   *   A boolean value.
    

    This can be more informative. We already know it is a bool from the @param above.

  6. +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
    @@ -45,7 +47,10 @@ public function assertTourTips($tips = []) {
    +      $this->assertTrue(empty($tips), 'Expected no tour (disabled) on the current page.');
    

    Message are not used in core assertions, except when needed as when in a loop.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

pooja saraah’s picture

StatusFileSize
new2.94 KB
new2.24 KB

Thanks for your suggestions @quietone
Addressed the comment #26 point-1,2,4,5
Attached patch against Drupal 10.1.x
Attached reroll patch

pooja saraah’s picture

Status: Needs work » Needs review
smustgrave’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update +Bug Smash Initiative
StatusFileSize
new1.91 KB
new2.86 KB

Took a shot at updating the IS
Addressed the remaining issues from #26

Tested using https://www.drupal.org/files/issues/2018-10-07/tour_ui-2073321-3.patch
Even though the issue for tour_ui still needs work enable and disable a tour through a ui.
Once disabled I confirmed the tour was no longer appearing.
Re-enabled and confirmed tour reappeared.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

This is bad behavior on my part. Moving to RTBC as this is blocking a feature or two for tour UI. And even though tour UI is not part of core there is talk that tour is going to be slated for removal. Would be nice to get this feature in before that freeze happens.

quietone’s picture

Status: Reviewed & tested by the community » Needs review

Yes, we do not self RTBC in the Drupal core issue queue. I am setting this back to needs review per Reviewed & tested by the community ["RTBC"] .

If this is block a contrib project, please add the correct tag.

For those interested, the proposal for discussing the removal of tour is at #3325445: [Policy] Remove tour module from core.

larowlan’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +    // Navigate and verify the tour_test_1 tip is found with appropriate classes.
    

    nit: >80

  2. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,33 @@ public function testTourFunctionality() {
    +    $this->assertTourTips([], TRUE);
    

    we can use a named argument here

  3. +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
    @@ -45,7 +47,10 @@ public function assertTourTips($tips = []) {
    +      $this->assertTrue(empty($tips));
    

    can return here and avoid the elseif

Couple of minor things

ameymudras’s picture

Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new1.21 KB

Attempting to fix the issues mentioned in #33

smustgrave’s picture

StatusFileSize
new1.46 KB
new2.85 KB

#34 didn't address 2 or 3.

For 2 it was testing an empty but now it's passing in values.
For 3 Adding a return that way doesn't do anything as it's the end of the if statement.

Think (could be wrong) this was more what @larowlan was saying.

The last submitted patch, 34: 3004897-34.patch, failed testing. View results

larowlan’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,34 @@ public function testTourFunctionality() {
    +    // Navigate and verify the tour_test_1 tip is found with
    

    should this be 'is not found'?

  2. +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
    @@ -45,7 +47,10 @@ public function assertTourTips($tips = []) {
    +    elseif (empty($tips)) {
    

    this can stay as an else, as an if, we returned in the above if path

Looks like #35.2 isn't handled yet, see https://php.watch/versions/8.0/named-parameters#named-param-optional-params for an example, I don't think we need to pass the empty array for the first argument as that's the default

smustgrave’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB
new2.88 KB

Addressed points #37 and #35.2

larowlan’s picture

  1. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,34 @@ public function testTourFunctionality() {
    +
    

    This line can be removed (can be fixed on commit)

  2. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,34 @@ public function testTourFunctionality() {
    +    $this->assertTourTips();
    

    Should we be passing the $tour here - to assert the one we expect to see is present?

  3. +++ b/core/modules/tour/tests/src/Functional/TourTest.php
    @@ -234,6 +234,34 @@ public function testTourFunctionality() {
    +    $this->assertTourTips(expectEmpty: TRUE);
    

    👌 noice

  4. +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
    @@ -45,8 +47,8 @@ public function assertTourTips($tips = []) {
    -    if (empty($tips)) {
    -      $this->fail('Could not find tour tips on the current page.');
    +    if ($expectEmpty) {
    +      return;
    

    I think we want

    $tip_count = count($tips);
    if ($tip_count === 0 && $expectEmpty) {
      // No tips found as expected.
      return;
    }
    if ($tip_count > 0 && $expectEmpty) {
      $this->fail(sprintf('No tips were expected but %d were found', $tip_count));
    }
    $this->assertGreaterThan(0, $tip_count);
    
    

    So we cover the three cases:

    * Expecting tips, but none
    * Not expecting tips, but found some
    * Not expecting tips, none found as expected

smustgrave’s picture

StatusFileSize
new2.72 KB
new4.68 KB

#39
1. Fixed
2. We can't as the $tour isn't an array
3. Thanks!
4. Updated

danielgry’s picture

StatusFileSize
new601.04 KB
new262.5 KB

Test results: PASS

Notes:
- Tested the latest patch on Drupal 10.1.x using DrupalPod to setup up the env
- Tested with the umami_demo profile
- I had to uninstall and reinstall the Tour module for a tour itself to be disabled

Outcome:
1. Spun up the test environment with DrupalPod and logged in as admin
2. Verified that the Tour module was enabled in the testing site
3. Visually confirmed that tours were enabled and working by going to Languages in configuration (see Screenshot 1)
4. Changed status of tour to "false" in a yml file under language module and cleared cache
5. Checked the language tour in testing site but the tour was still visible
6. Uninstalled and then reinstalled the Tour module in the DrupalPod cli
7. Confirmed that only the language tour was disabled in the testing site (see Screenshot 2)
8. Re-enabled the language tour by setting status to “true” but it was only visible again in the testing site after I reinstalled the tour module

smustgrave’s picture

If you've tested and reviewed the ticket and think it's good to go feel free to change status to RTBC.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Taking #41 as a review.

This has been a block for tour_ui ability to setup tour statuses for a long time.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

  • larowlan committed 23fc2b6c on 11.x
    Issue #3004897 by clemens.tolboom, smustgrave, ridhimaabrol24, pooja...
larowlan’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

Committed and pushed to 10.1.x
I think this is borderline feature, so splitting the difference and marking as a task.

Didn't backport because we're in RC phase and I don't think this meets the requirements for commit during RC

Status: Fixed » Closed (fixed)

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