From 1bf2ab5ade88ae965100116e1f587c4333589195 Mon Sep 17 00:00:00 2001
From: Alexandre Dias <alex.jm.dias@gmail.com>
Date: Tue, 7 Jan 2025 13:34:07 +0000
Subject: [PATCH] ISAICP-9192: Use bundles and remove extra tests.

---
 .../block.block.openeuropawebtoolsetrans.yml  | 13 +++++++-
 .../interoperable_europe.feature              | 30 +++++--------------
 web/themes/iop/iop.theme                      |  3 +-
 3 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/config/sync/block.block.openeuropawebtoolsetrans.yml b/config/sync/block.block.openeuropawebtoolsetrans.yml
index be00fad6e3..03daa05ccf 100644
--- a/config/sync/block.block.openeuropawebtoolsetrans.yml
+++ b/config/sync/block.block.openeuropawebtoolsetrans.yml
@@ -4,6 +4,7 @@ status: true
 dependencies:
   module:
     - joinup_core
+    - node
     - oe_webtools_etrans
     - system
   theme:
@@ -36,5 +37,15 @@ visibility:
       - entity.taxonomy_term.delete_form
   request_path:
     id: request_path
+    negate: true
+    pages: ''
+  'entity_bundle:node':
+    id: 'entity_bundle:node'
     negate: false
-    pages: "/interoperable-europe/news/*\r\n/interoperable-europe/event/*\r\n/interoperable-europe/document/*\r\n/interoperable-europe/discussion/*"
+    context_mapping: {  }
+    bundles:
+      custom_page: custom_page
+      discussion: discussion
+      document: document
+      event: event
+      news: news
diff --git a/tests/features/communities/interoperable_europe/interoperable_europe.feature b/tests/features/communities/interoperable_europe/interoperable_europe.feature
index bec750b3c6..d1e1afeb22 100644
--- a/tests/features/communities/interoperable_europe/interoperable_europe.feature
+++ b/tests/features/communities/interoperable_europe/interoperable_europe.feature
@@ -9,15 +9,13 @@ Feature:
     When I click "Discover more"
     Then I should see the heading "Joinup is becoming Interoperable Europe Portal"
     And the page should be rendered using the "Interoperable Europe" theme
-    # Uncomment this in ISAICP-9192.
-    # And I should not see the link "Report abusive content"
+    And I should not see the link "Report abusive content"
 
     # Test other pages.
     When I visit "/interoperable-europe/initiatives"
     Then the page should be rendered using the "Interoperable Europe" theme
     And I should see the heading "Initiatives"
     And I should see the heading "Join our community!"
-    And I should not see the link "Report abusive content"
 
     # Event.
     When I visit "/interoperable-europe/event/save-date-semic-coming-back-8-december-2021"
@@ -25,7 +23,6 @@ Feature:
     And I should see the text "Event"
     And I should not see the heading "Event"
     And I should see the link "more events"
-    And I should not see the link "Report abusive content"
     And I should see the text "Published on: 19/11/2021"
     And I should see the heading "Join our community!"
     When I click "more events"
@@ -37,7 +34,6 @@ Feature:
     And I should see the text "News"
     And I should not see the heading "News"
     And I should see the link "more news"
-    And I should not see the link "Report abusive content"
     And I should see the text "Published on: 19/11/2021"
     And I should see the heading "Join our community!"
     When I click "more news"
@@ -82,18 +78,7 @@ Feature:
     Then I should see the error message "Title field is required."
 
   @javascript
-  Scenario: Report link and eTranslate button are not available in IOP custom pages.
-    Given custom_page content:
-      | title    | collection           |
-      | IOP page | Interoperable Europe |
-
-    When I am logged in as a user with the authenticated role
-    And I go to the "IOP page" custom page
-    Then I should not see the link "Report abusive content"
-    And I should not see the button "Translate"
-
-  @javascript
-  Scenario Outline: Report link and eTranslate button are not available in IOP.
+  Scenario Outline: Visibility of Report link and eTranslate button.
     Given <type> content:
       | title      | collection           |
       | IOP <type> | Interoperable Europe |
@@ -104,11 +89,12 @@ Feature:
     And I should see the button "Translate"
 
     Examples:
-      | type       |
-      | news       |
-      | event      |
-      | discussion |
-      | document   |
+      | type        |
+      | news        |
+      | event       |
+      | discussion  |
+      | document    |
+      | custom_page |
 
   @javascript
   Scenario: Regression test that ensures that search bar works fine.
diff --git a/web/themes/iop/iop.theme b/web/themes/iop/iop.theme
index cb03ec2679..48d2113803 100644
--- a/web/themes/iop/iop.theme
+++ b/web/themes/iop/iop.theme
@@ -122,8 +122,7 @@ function iop_preprocess_node(array &$variables): void {
   }
 
   // Disables the "Report" link for IOP.
-  $node = \Drupal::routeMatch()->getParameter('node');
-  if (!$node instanceof NodeInterface || isset($variables['content']['report'])) {
+  if (isset($variables['content']['report'])) {
     $variables['content']['report']['#access'] = FALSE;
   }
 
-- 
GitLab