neos / neos-ui

Neos CMS UI written in ReactJS with Immutable data structures.
GNU General Public License v3.0
265 stars 135 forks source link

Preview button leads to validation error for hidden pages #2500

Closed Sebobo closed 4 years ago

Sebobo commented 5 years ago

Description

When opening the preview for a hidden page a validation error shows up instead of handling the error or showing the preview.

Steps to Reproduce

  1. Hide page in backend
  2. Click on preview button

Expected behavior

Either a meaningful message or the actual preview.

If it shouldn't be possible to see the preview for hidden pages, the editor shouldn't get the option to open it. If it should be possible, then we need to show the rendered page.

Actual behavior

The following error appears:

Validation failed while trying to call Neos\Neos\Ui\Controller\BackendController->redirectToAction()

Affected Versions

Neos: 4.3

UI: 3.4

Sebobo commented 5 years ago

Older versions of the UI might be affected too, but didn't have time yet to check.

kdambekalns commented 5 years ago

The same holds true for "hidden before/after" and it worked with the legacy UI🗡, according to a customer.

🗡 Yes, since we simply linked to domain.tld/what/ever@user-foobar and thus hidden nodes were visible

kdambekalns commented 4 years ago

So it seems quite some people are tripping over this and the "ugly URLs" as well as hidden things being shown unexpectedly.

Maybe a solution would be to add the parameter only when previewing a document that is itself hidden. That would avoid the problem, but keep the behaviour for other documents?!

dimaip commented 4 years ago

I would expect such feature to work this way: hidden status on the document node would be ignored, but all other nodes within it would respect their hidden status.

dlubitz commented 4 years ago

@kdambekalns At the moment this feature leads to some (hopefully unexpected) behavior. If I have an hidden content node and click the preview button, I see the hidden content in the preview (see screenshots). AFAIS the feature should just show hidden document nodes, but not content nodes.

(Neos UI 4.0.1, Neos 4.3.7)

image

image

kdambekalns commented 4 years ago

Ok, I'll give that a go…

bwaidelich commented 4 years ago

@kdambekalns This is affected by https://github.com/neos/neos-development-collection/issues/2653 as well (which we plan to include into 5.1). Would be great if we could join forces here!

kdambekalns commented 4 years ago

To fix this for Neos 4.0 onwards, I am working on this now. ~But when trying, the request that renders the preview does not even have Neos.Neos:Backend.GeneralAccess so I get just "Sorry, the page you requested was not found.". How can this fail for anyone in any other way? I am puzzled on so many levels now…~ Gnah, that's caused by the frontend login package in the demo site setup… That caught me earlier already…

kdambekalns commented 4 years ago

Ok, this started out as a bugfix for the validation error. That must be fixed, and it is by now.

But I got carried away by the wish to actually preview a hidden node (which also works by now), but had the side effect of also showing all hidden content in the preview.

Too late did I realize that… this worked before the React UI only because we have very specialized handling for showing URLs that have @some-workspace parts in them. With the way this is handled now, one can only have one node with one content being shown. And that means either you do not get the node, or it will "contain" all hidden nodes as well. There is o middle ground.

That being said, one customer requirement was "editors need the URL for pages not yet published or still hidden", e.g. to include them in a newsletter. And that is still possible, even if we revert the "show hidden documents" part - the URL can be copied from the browser just fine, it will start to work as soon as the document is no longer hidden.

After all, as @robertlemke pointed out to me today: The correct preview of a hidden document is a 404.

kdambekalns commented 4 years ago

The validation error is fixed, preview works "as expected" (see above).