Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-8910 menu publish #598

Merged
merged 8 commits into from
Oct 4, 2023
Merged

UHF-8910 menu publish #598

merged 8 commits into from
Oct 4, 2023

Conversation

rpnykanen
Copy link
Contributor

@rpnykanen rpnykanen commented Sep 22, 2023

UHF-8910

Local main navigation can have menu items with wrong translation (swedish navigation has finnish links)
Local main navigation shows links to unpublished nodes
Sote is a great candidate for testing due to bunch of bad links under "disability services"-link in main menu

What was done

Filter out links without proper translation from main navigation when incognito.
Filter out links related to unpublished node from main navigation when incognito.

How to recreate:

  1. go to sote test-environment and check the english main navigation(incognito): you should see bad links under "disablity services" link

How to install

  • Make sure your instance is up and running on latest dev branch.
    • git pull origin dev
    • make fresh
  • Update the Helfi Platform config
    • composer require drupal/helfi_platform_config:dev-UHF-8910_menu_publish
  • Run make drush-updb drush-cr

How to test

Using SOTE:

  • Setup the site

    • The menu should have bad links by default under 'disability services'-link
  • Before the fix is installed, there should be 6 links under disability services

  • After installing the fix to sote, disability services should have only 1 link under it

  • Go and edit english main navigation. Check the links under disability services. (#UHF-9012)

    • Make sure the related nodes' translations are published.
    • Make sure the menu items' translations are published.

After publishing the nodes and menu links, incognito user should see correct links in main navigation

Manually test adding new item to main navigation:

  • Create a new node with all main languages (fi, en, sv). Add the node to main navigation. Remember to set the node and translations published
    • Remember to translate node title and menu title
    • While creating translations for the node, make sure you add "julkaistu päävalikossa" for finnish and one other translation
  • Go and see the main navigation incognito
  • Go through the translations: NOTE: You might need to refresh the page after switching language before the menu changes

Result while browsing the translations:

  • Finnish should be seen as finnish
  • The translation you added the "julkaistu päävalikossa" selection should be seen with correct translation
  • For the third language, the menu link shouldn't be visible at all.

Node status

  • Unpublish any of the nodes translations which is currently visible in main navigation, other than finnish preferably (You should test finnish separately)

The unpublished node should not be visible in the main navigation

@codecov-commenter
Copy link

codecov-commenter commented Sep 22, 2023

Codecov Report

Merging #598 (2aa982a) into main (f560477) will increase coverage by 0.27%.
The diff coverage is 22.22%.

❗ Current head 2aa982a differs from pull request most recent head 4a51f9a. Consider uploading reports for the commit 4a51f9a to get more accurate results

@@             Coverage Diff              @@
##               main     #598      +/-   ##
============================================
+ Coverage     12.74%   13.02%   +0.27%     
- Complexity      236      244       +8     
============================================
  Files            30       31       +1     
  Lines           902      929      +27     
============================================
+ Hits            115      121       +6     
- Misses          787      808      +21     
Files Coverage Δ
src/Menu/FilterDisabledTranslations.php 22.22% <22.22%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@teroelonen teroelonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this one quite much and it worked well however the last bit is where I think there is still an issue. If you unpublish a node you shouldn't in my opinion be able to check the "Published in the main menu" checkbox because if that is checked the content is visible in the global navigation even if the node is unpublished.

Copy link
Contributor

@teroelonen teroelonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes some of the problems and a separate ticket was created of the issues with translations: UHF-9083

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants