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

BUGFIX: Show and apply all changes in workspace review #4588

Merged
merged 5 commits into from
Oct 17, 2023

Conversation

ahaeslich
Copy link
Member

@ahaeslich ahaeslich commented Oct 8, 2023

Fixes: #4587
Relates: #4563

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

- Fix assignment of `siteNode`
- Fix path generation to fix grouping of changes by document
- Fix publishing of deleted node
- Fix checkbox behaviour to not publish new child nodes independent of parent

Relates: #4573
@ahaeslich
Copy link
Member Author

ahaeslich commented Oct 10, 2023

While testing this change in our project we found that:

Selecting all nodes by using "Select all current changes" and click on " Publish selected changes to live" (Calls publishOrDiscardNodesAction) works. ✅

Selecting nothing and click on " Publish all changes to live" (Calls publishWorkspaceAction) will lead to this error message:

The base workspace has been modified in the meantime; please rebase.

Edit: ... sometimes 🤯
Edit 2: can reproduce this strange behaviour without my changes ... happy us ... this calls for a new issue (#4591)

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.

As written on Slack, I found it hard to review this PR because it contains unrelated changes (it seems).
Also without any tests it's hard to tell what changes actually fix the bug. Maybe you could add some inline comments (in code or just as PR comments) to explain the fix?

}
}

// Neither $documentNode, $siteNode or its cannot really be null, this is just for type checks;
// We should probably throw an exception though
if ($documentNode !== null && $siteNode !== null && $siteNode->nodeName) {
$siteNodeName = $siteNode->nodeName->value;
$documentPath = implode('/', array_slice(array_map(
$documentPath = implode('/', array_reverse(array_map(
Copy link
Member

Choose a reason for hiding this comment

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

I'm trying to understand: (how) is this related to the issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

In both places I didn't quite understand why we need the paths in the first place. It's also used by the current JS logic to select and group nodes by document. And in neos 8 that starts at the side node and not with the lowest node.

Copy link
Member

Choose a reason for hiding this comment

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

And in neos 8 that starts at the side node and not with the lowest node

So that's why we change array_slice to array_reverse right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

$relativePath = str_replace(
sprintf('//%s/%s', $siteNodeName, $documentPath),
'',
implode('/', array_map(
implode('/', array_reverse(array_map(
Copy link
Member

Choose a reason for hiding this comment

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

and here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above.

@ahaeslich
Copy link
Member Author

As written on Slack, I found it hard to review this PR because it contains unrelated changes (it seems). Also without any tests it's hard to tell what changes actually fix the bug. Maybe you could add some inline comments (in code or just as PR comments) to explain the fix?

Thx for your questions ❤️ I added some comments in the code as I think we might need them there for a future refactoring.

@ahaeslich ahaeslich requested a review from bwaidelich October 13, 2023 08:39
@ahaeslich
Copy link
Member Author

We can update this to use Neos.Neos:Site when #4563 is merged

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

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

I can confirm that the changes count doesnt reflect any new changes (the green ones) neither for user workspaces or an actual workspace:

before
image

after (this fix)
image

modifications seem to be correctly reflected already:
image

and still work after this fix.


So thanks for taking care of this. I approve by testing ;)

@ahaeslich
Copy link
Member Author

Thx @mhsdesign for merging ❤️. So I think we should be good to go here.

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.

This one is a bit hard to review (by reading). But we agreed to go for it as it definitely make things better!

Thanks for taking care!

@bwaidelich bwaidelich merged commit fc37b92 into 9.0 Oct 17, 2023
5 checks passed
@bwaidelich bwaidelich deleted the bugfix/review-workspace-changes branch October 17, 2023 10:20
ahaeslich added a commit that referenced this pull request Oct 19, 2023
This fixes a merge error introduced with fa38119

We check `$ancestor` to be of nodeType `Neos.Neos:Site` so this is the correct value for `$siteNode`.

Relates: #4588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

BUG: Workspace review doesn't show new documents and their child nodes
4 participants