Orckestra / C1-CMS-Foundation

C1 CMS Foundation - .NET based, open source and a bundle of joy!
https://c1.orckestra.com/
Other
251 stars 109 forks source link

The changed meta data values stay on even if you don't save changes on a page #697

Open wwwysocki opened 4 years ago

wwwysocki commented 4 years ago

Prepare:

  1. Create a meta type.
  2. Add two fields Field1 and Field2 of the type "String"
  3. Make both fields optional (Optional: Yes)
  4. Add a validation rule to Field1: Composite.Utils.Validation.StringLengthValidation
  5. Set the rule's parameters as: min = 4, max = 8
  6. Add the metafiled of this type to a page (Page1)
  7. Select "Do not inherit"
  8. Specify a value within the rule for Field1 - a string betwen 4 and 8 characters

Repro:

  1. Edit Page1
  2. On the "Metadata" tab, change the value in Field1 to an invalid one (for example, 3 characters long)
  3. Change the value in Field2
  4. Click "Save" > Validation message & window pop up
  5. Close the validation message
  6. Close the validation popup over the affected field
  7. Close the page itself
  8. Click "No" in the popup that warns of unsaved changes
  9. Re-open the page in the editor
  10. Check Field1 and Field2 values

Expected:

Unchanged (as before Steps 2-3)

Actual:

The fields keep the new values from Steps 2-3

Workaround

  1. Restart the server
  2. Re-open the page
mawtex commented 4 years ago

Downgrading the severity - this has been the default behavior always, and so far only the core devs and a QA seem to have noticed, so practically the issue has a very small impact.

A fix would require that all (yet unsaved) data changes are "mocked" during preview, at data layer level, since the code rendering page output is "free querying" for the meta data. This issue is true for any page data, which is retrieved via queries, including content, title etc.