dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
863 stars 468 forks source link

Modify pages from layout #28758

Open bryanboza opened 5 months ago

bryanboza commented 5 months ago

⚠️ Test Case failed on TUSKR ⚠️

URL:

https://tuskr.live/project/20c40fe1-2ed8-4b8a-b405-63401ffc4b8f/test-case/9ae655a4-3822-47e2-b773-d59f1c139b04

Name:

Modify pages from layout

Description:

In the pages editor, users are currently modifying the original template instead of creating custom layouts. This practice can lead to unintended changes to the original template, affecting other pages that rely on it and limiting the flexibility for unique page designs.

Pre-conditions

Steps:

Expected Behavior:

Make sure you we are creating a custom layout instead to modify the original template 

Test Run Information:

Name: Page Editor UVE
Url: https://tuskr.live/test-run/eea6838f-fc39-4f6f-a718-506254e46308
erickgonzalez commented 5 months ago

NOTES:

I investigated this since we first saw it on a customer.

The issue seems to be here https://github.com/dotCMS/core/blob/8f166f072e7e94cbbcdb4b1f5b80cb9f737519f4/dotCMS/src/main/java/com/dotcms/rest/api/v1/page/PageResourceHelper.java#L456 we are only validating to create a new layout if the template isn't being used by another page, which I think is wrong since we always should create layout regardless the number of pages using the template when we edit the template from the layout screen.

I don't know if this change was intended @john-thomas-dotcms @dsilvam @freddyDOTCMS since it was done for experiments.

I checked previous versions, and we had this validation form.isAnonymousLayout(), which checks the title of the template; if it is blank, it means a new layout is being created since we sent without a title the payload. Adding this validation should fix the issue.

sfreudenthaler commented 4 months ago

Slack discussion with context on the problem

sfreudenthaler commented 4 months ago

Let's not forget that we've got the same problem with the file based templates too https://github.com/dotCMS/core/issues/26415

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

john-thomas-dotcms commented 1 month ago

This was an intentional change. I wasn't involved in the decision to change the behavior, so I can't speak to the reasons for the original change. I also think the current behavior is confusing.

But the idea about what the behavior should be has gone back and forth, and needs to be nailed down and agreed on before any new changes are made.