silverstripe / silverstripe-userforms

UserForms module provides a visual form builder for the Silverstripe CMS. No coding required to build forms such as contact pages.
BSD 3-Clause "New" or "Revised" License
135 stars 225 forks source link

Editing items on a duplicated page edits in two pages #1298

Closed torleif closed 1 month ago

torleif commented 4 months ago

Module version(s) affected

5.13.1

Description

When you clone a userform page (duplicate) it results in the userform page having references to the elemental items you copied, and any other references to other DataObjects

How to reproduce

Steps to reproduce:

  1. Install dnedesign/silverstripe-elemental
  2. Apply the DNADesign\Elemental\Extensions\ElementalPageExtension extension to the userform page type
  3. Create a userform page and add at least one elemental block to it.
  4. right click on a userform page and select 'Duplicate' > 'Duplicate this page'
  5. edit an elemental block on that page
  6. the elemental block you edited will also be modified on the page you duplicated

Deleting the elemental item and recreating does not help, because it's the ElementalArea reference that got copied.

You have to delete the entire page and start again. Very frustrating.

Possible Solution

setting $cascade_duplicates correctly, or disabling it from being duplicated

Additional Context

This job was originally logged against https://github.com/silverstripe/silverstripe-elemental/issues/1197, but given any

Validations

Acceptance Criteria

PRs

GuySartorelli commented 4 months ago

It looks like you've just directly copied the original text from https://github.com/silverstripe/silverstripe-elemental/issues/1197 which doesn't have anything specific to this module at all. Please update the issue description so it's actually talking about the problem you've encountered, which according to https://github.com/silverstripe/silverstripe-elemental/issues/1197#issuecomment-2146532219 is somehow unique to this module.

I assume since you're talking about elemental blocks this specifically impacts https://github.com/dnadesign/silverstripe-elemental-userforms? Should the issue be in that module instead?

torleif commented 4 months ago

I’ve updated the description.

The issue does not just affect elementalarea, it affects all references to any other data objects. Though elemental area would be the main target to fix given it’s a supported silverstipe module.

We updated the cascade duplicates in yml, which seems to address the issue. Though there likely was a reason why it was set to false in the php code

GuySartorelli commented 4 months ago

Ahh, okay thanks for that extra context.

It looks like cascade_duplicates was set to false in this PR which was fixing https://github.com/silverstripe/silverstripe-userforms/issues/727 - so any fix will need to ensure there's no regression of that issue.

emteknetnz commented 1 month ago

Linked PR has been merged, this will be released with CMS 5.3