Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-5359

Invalid siteaccess passed to the page builder preview

    XMLWordPrintable

Details

    • Ibexa Experience
    • Yes

    Description

      It seems page builder preview uses incorrect siteaccess in a special-case scenario. It is related to all content types with "always available" flag turned off and multi-language sites.

       

      Steps to reproduce

      1. Install Ibexa DXP v4
      2. Add new language in Ibexa back-office.
      3. Configure siteaccesses for multi-language setup
      ibexa:
          siteaccess:
              list:
                  - site
                  - pl
              groups:
                  site_group: [site, pl]
              default_siteaccess: site
              match:
                  Map\URI:
                    pl: pl
                  URIElement: 1
          system:
              site:
                  languages: [eng-GB, pol-PL]
              pl:
                  languages: [pol-PL, eng-GB]
                  content:
                      tree_root:
                          location_id: 2
      1. Uncheck "Always available" flag for "Landing page" content type.
      2. Create new landing page in eng-GB.
      3. Create new translation of the same landing page in pol-PL.

       

      Result

      All of the template translations as well as fragment subrequests are in eng-GB and preview templates shows current siteaccess "site" even though we're currently editing content in pol-PL and "pl" siteaccess is displayed in the page builder's preview top bar.

       

      Expected

      Preview's template translations should be in pol-PL and the same siteaccess (pl) from page builder's preview top bar should be passed to the preview template.

       

      Note

      This issue still occurs if we decide to edit again same landing page in pol-PL language.

      It seems the incorrect siteaccess is passed to the preview template - should be "pl", but "site" received. Quick debugging shows an issue here:

      # Ibexa\Bundle\PageBuilder\Controller\PageController::previewAction()
      
      $resolvedSiteAccess = $isAlwaysAvailable
          ? $fallbackSiteAccessName
          : $this->siteaccessService->resolveSiteAccessForContent($content, $fallbackSiteAccessName);

      I don't know why we're trying to resolve siteaccess for non-always-available content instead of just forcing $fallbackSiteAccessName. The method shown above is returning first matched siteaccess (in our case "site" - eng-GB). If we want to validate $fallbackSiteAccessName, we should get the whole list of valid siteaccesses for given content and compare it agains fallback.

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              fb6bece7-3701-4aec-a948-a26d63a646c0@accounts.ibexa.co Stanisław Klimaszewski
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: