Skip to content

Localized child pages don't get deleted correctly if parent pages have localization added after they were created #5383

@mwigley-trilogy

Description

@mwigley-trilogy

Description of bug

Requires the localization module
Localized child pages don't get deleted correctly if parent pages have localization added after they were created.

Ordinarily whenever a new localized child page is added, it is linked to the corresponding localized version of its parent page:

In TabController.CeateLocalizedCopyInternal:
                // Get the original Tabs Parent
                // check the original whether have parent.
                if (!Null.IsNull(originalTab.ParentId))
                {
                    TabInfo originalParent = this.GetTab(originalTab.ParentId, originalTab.PortalID, false);

                    // Get the localized parent
                    TabInfo localizedParent = this.GetTabByCulture(originalParent.TabID, originalParent.PortalID, locale);
                    localizedCopy.ParentId = localizedParent.TabID;
                }

But if you create a parent page, make it non-localized, add localized children, and then localize the parent the child pages aren't updated to have their corresponding localized parent.

We have found one particular thing that this breaks, but there are probably more:

If you then delete the localized child page, it will mark both child pages as deleted in the database, but only the original localization of the child page will show up in the recycle bin (note that you have to switch locales with the locale selector to see correctly deleted localized pages in the recycle bin).

Steps to reproduce

  1. Update site language settings:
    1. Go to Settings -> Site Settings -> Languages tab
    2. If only English (United States) language is present in the Languages list
      1. Click Add New Language
      2. Select English (CAN)
      3. Click Save button
        1. If the “Allow Content Localization” option is not on:
          1. Turn it on
          2. Click the newly shown Enable Localized Content button
          3. In the new panel, turn on the “Make All Pages Translatable” switch
          4. Click Enable Localized Content button
          5. Wait until all pages have been processed
  2. Add a parent page
    1. Go to Content -> Pages
    2. Click Add Page button
    3. Give it the name and title: “Parent page”
    4. Click Add Page button at the bottom
    5. Click Publish at the bottom right
    6. Go back to Content -> Pages, and select the Parent Page
    7. Click on the new Localization tab
    8. Click the “Make Page Neutral” button at the bottom left, and Click Yes to confirm deletion of localized pages if they exist
  3. Add a child page
    1. Go to Content -> Pages
    2. Select Parent Page in the list on the left
    3. Under … menu of the parent page, click Add Page option
    4. Give it “Child Page” name
    5. Click “Add Page” at the bottom, and then “Publish” button on the main page
  4. Localize the child page
    1. Go to Content -> Pages and select the child page in the list on the left
    2. Click the new Localization tab
    3. Click “Add Missing Languages” button
    4. Add a suffix to the pages titles / names (us / ca), just to easily distinguish them
    5. Click Update Localization button, and confirm by clicking Continue
  5. Localize the parent page
    1. Go to Content -> Pages and select the parent page
    2. In the Localization tab, click Make Page Translatable button
    3. Add us/ca suffixes to US and CAN versions titles / names
    4. Click Update Localization button, and Continue
  6. Delete the child page
    1. Go to Content -> Pages and select the child page
    2. Click Delete button at the bottom and confirm with Delete button in the popup
  7. Go to Content -> Recycle Bin
  8. The US Child page should be present in the bin
  9. Change language to English (Canada) at the top of the page
  10. Go to Content -> Recycle Bin. The bin is empty
  11. Switch back to English (US) in the top
  12. Go to Content -> Recycle Bin, and empty the bin.
  13. Now both the US and Canada language Recycle Bins are empty but if you check the Tabs table in the database, the US version of the page is deleted, but a zombie version of the Canada page is still there.

Current behavior

When a nonlocalized parent with localized children has localization added, the localized children are not updated to point to their localized parents. This means that deleted localized children without the default language do not show up in the recycle bin.

Expected behavior

When a nonlocalized parent with localized children has localization added, the localized children should be updated to point to their localized parents.

When the child page is then deleted, all localized children should show up in their corresponding localized recycle bin.

Screenshots

Localized child page remains attached to default localization parent page in database:
image

Should actually be attached to the localized version of its parent page:
image

US recycle bin

image

Switching with language selector:
image

CA recycle bin - empty:

image

Error information

Additional context

Affected version

Reproducible on any remotely modern version.

  • 10.00.00 alpha build
  • 09.11.00 release candidate
  • 09.10.02 release candidate
  • 09.10.01 latest supported release

Affected browser

Any - is a server side issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions