Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Highlevel Workspace API #4943

Merged
merged 38 commits into from
Apr 5, 2024
Merged

FEATURE: Highlevel Workspace API #4943

merged 38 commits into from
Apr 5, 2024

Conversation

nezaniel
Copy link
Member

@nezaniel nezaniel commented Mar 14, 2024

EDIT: Most parts of the api have been overhauled again with #5146

This provices a high level workspace model to be used e.g. by the Neos UI.

(see neos/neos-ui#3752)

Its purpose is to explicitly cover Neos' intentions of publishing, being publishing / discarding whole documents or sites. This is implemented as explicitly named methods that can be used by the UI. Internally it relies on the change finder projection, which is properly filled with above UI change.

grebaldi added a commit to neos/neos-ui that referenced this pull request Mar 19, 2024
This commit MUST be removed before merging PR #3752
@nezaniel nezaniel marked this pull request as ready for review March 19, 2024 23:51
Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good idea to coordinate these tasks in a central place!
Just did a first pass and added some nitpicky comments. Apart from those I have a couple of questions/suggestions:

  • I struggle a bit with the naming of the commands, e.g. DiscardDocument does not really discard any document. Should we suffix those with "*Changes", e.g. DiscardDocumentChanges?
  • Out of scope but looking at the code I was thinking: Shouldn't most projections work with workspace names instead of cs ids eventually? E.g. $changeFinder->findByContentStreamId($contentStreamId); should become $changeFinder->findByWorkspaceName($workspaceName); at some point. This would mean some more workspace<->csid tables but the logic is pretty simple and we would not have to rely on the WorkspaceFinder everywhere (i.e. the workspace projection would be used only to manage workspaces really)

Neos.Neos/Classes/Domain/Workspace/WorkspacePublisher.php Outdated Show resolved Hide resolved
Neos.Neos/Classes/Domain/Workspace/WorkspacePublisher.php Outdated Show resolved Hide resolved
Neos.Neos/Classes/Domain/Workspace/WorkspacePublisher.php Outdated Show resolved Hide resolved
Neos.Neos/Classes/Domain/Workspace/WorkspacePublisher.php Outdated Show resolved Hide resolved
grebaldi and others added 2 commits March 20, 2024 15:22
WorkspacePublisher shouldn't be an extension point.

Co-authored-by: Bastian Waidelich <[email protected]>
@grebaldi
Copy link
Contributor

grebaldi commented Mar 20, 2024

I noticed a thing:

The way we are distinguishing documents and sites leads to unintended beavior when our document happens to be the site. Basically, when I do publishDocument on the site node, the behavior is indistinguishable from publishSite. We will need some guard around publishDocument to ensure that only content nodes will be published.
see: #4943 (comment)

EDIT:

Regarding the naming of the commands (as raised by @bwaidelich), I'd opt for:

  • PublishChangesInSite
  • DiscardChangesInSite
  • PublishChangesInDocument
  • DiscardChangesInDocument

...to clarify that it's not only about changes to the respective node itself.

@kitsunet
Copy link
Member

@grebaldi shouldn't the check in isChangePublishableWithinAncestorScope ultimately limit it to anything not of the defined type and that would make the difference between document and site?

@grebaldi
Copy link
Contributor

@kitsunet:

@grebaldi shouldn't the check in isChangePublishableWithinAncestorScope ultimately limit it to anything not of the defined type and that would make the difference between document and site?

You are correct, of course. My assessment was wrong.

I could swear I've seen this behavior during the UI implementation, so I was a bit too quick on deducing this to be the cause 😅. I just tested this again, and it works correctly. Don't mind my observation from above.

@mhsdesign
Copy link
Member

mhsdesign commented Apr 3, 2024

Tested successfully locally against the Neos Ui e2e and found some additional adjustments / anti footgun adjustments: #4974

I didnt want to push these commits directly into your branch, but feel free to merge my review pr into this one @nezaniel ;)

@mhsdesign mhsdesign mentioned this pull request Apr 3, 2024
6 tasks
Copy link
Member Author

@nezaniel nezaniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get* implies a no-op, which potential creation is not. Either we switch to getOrCreate or something neutral like provide*

@mhsdesign
Copy link
Member

True that. Was inspired by the ContentRepositoryRegistry where its get but actually also rather a getOrBuild... maybe retrieveForWorkspaceName is the best naming?

@nezaniel
Copy link
Member Author

nezaniel commented Apr 4, 2024

Mmh, not sure, retrieve sounds like it is already there and just has to be brought.

@nezaniel
Copy link
Member Author

nezaniel commented Apr 5, 2024

I think provideFor* makes the most sense, especially later for provideForCurrentUser. Also, that's what providers do, just like Finders find* stuff and Factories build* stuff.

@mhsdesign mhsdesign mentioned this pull request Apr 5, 2024
35 tasks
Copy link
Member

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 by reading, loving it!

@bwaidelich bwaidelich changed the title Publishing bonanza Highlevel Workspace API Apr 5, 2024
@nezaniel nezaniel merged commit f1e7d73 into 9.0 Apr 5, 2024
11 checks passed
@nezaniel nezaniel deleted the publishingBonanza branch April 5, 2024 11:45
@mhsdesign mhsdesign changed the title Highlevel Workspace API FEATURE: Highlevel Workspace API Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants