Skip to content

Conversation

danrot
Copy link
Contributor

@danrot danrot commented Nov 21, 2016

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets fixes parts of #2067, fixes #3062
Related issues/PRs none
License MIT
Documentation PR none

What's in this PR?

This PR adds versioning support for pages.

TODO

  • Update changer and changed after restoring a version to user who triggered the restore
  • Find out how jackrabbit import/export workspaces works with versioning information
  • Test with jackalope-doctrine-dbal implementation
  • Decouple mix:versionable mixin from sulu:page
  • Fix test fails caused by xml import
  • Remove select boxes from datagrid
  • Add action button for restore action
  • Handle non-localized properties
  • Pagination
  • Show full name for author
  • Remove creator
  • Rename "Changed by" to "Last change"
  • Add changelog

@danrot danrot force-pushed the feature/versioning branch 6 times, most recently from 5b8ea29 to a691e8f Compare November 29, 2016 07:32
@danrot danrot force-pushed the feature/versioning branch 3 times, most recently from dae5da1 to dc46dc6 Compare December 12, 2016 13:17
@danrot danrot force-pushed the feature/versioning branch 4 times, most recently from 9ae0de6 to e00d978 Compare December 13, 2016 09:32
@chirimoya chirimoya self-requested a review December 21, 2016 08:00
@danrot danrot force-pushed the feature/versioning branch from e00d978 to cb778ed Compare December 22, 2016 09:30
@danrot danrot force-pushed the feature/versioning branch from cb778ed to 5ba1738 Compare January 9, 2017 08:16
@danrot
Copy link
Contributor Author

danrot commented Jan 9, 2017

@chirimoya I am working on introducing the flag, what should be the default? I would go for false, since it is not working with jackalope-doctrine-dbal.

@@ -776,6 +776,17 @@ public function postTriggerAction($uuid, Request $request)
$this->getDocumentManager()->removeDraft($data, $language);
$this->getDocumentManager()->flush();
break;
case 'restore':
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we somehow disable this action if versioning is disabled? I'd say we should, the question is how. Put all of the code in this case in a if, and let the code fall through, or throw the exception in this branch? As Unrecognized action or something like versioning is disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chirimoya When thinking about it... Should we move that functionality to the VersionController, and deactivate the version controller as a whole?

@@ -11,6 +11,11 @@ sulu_content.node.seo:
parent: sulu_content.node
resource: Sulu\Bundle\ContentBundle\Controller\SeoController

sulu_content.node.versions:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should probably not be registered if versioning is disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be possible with custom route loaders.

@@ -259,6 +259,39 @@ define([
}
]);

this.sandbox.start([
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't show if versioning is disabled.

<span class="name">...</span> (<span class="date">...</span>)
</div>
</div>
</div>

<div id="versions">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't output if versioning is disabled.


<service id="sulu_document_manager.suscriber.behavior.version"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't register when versioning is disabled.

@@ -49,6 +49,7 @@ public function getDeclaredSupertypeNames()
{
return [
'sulu:base',
'mix:versionable',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't include mixin directly in NodeType, otherwise it won't be usable in PHPCR implementations without versioning.

@danrot danrot force-pushed the feature/versioning branch 4 times, most recently from ad4e4e2 to 0d4db89 Compare January 10, 2017 10:17
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function postAction(Request $request, $uuid, $version)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cool thing here is that we don't need the @Post annotation as we have in the NodeController the $version parameter will also be added to the route from the method signature.

The bad thing is that the security is not working correctly then, since it is recognizing the POST as create, which means that every who is allowed to add a page can also restore it...

That's probably part of a bigger issue, we've got several ways to handle this.

  1. Find a different way to distinguish between add and create in security (would have to think about that, maybe if the last part excluding the query string is number or uuid?)
  2. Handle security without the fancy helpers Sulu gives us.
  3. Rename that action to postTrigger action as we are used to it, and add a @Post annotation. The drawback is that we have to include the parent route in the annotation: /nodes/{uuid}/versions/{version}

Copy link
Member

Choose a reason for hiding this comment

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

use postAction and validate query parameter action or url last segment is placeholder

@@ -18,6 +18,10 @@ public function registerContainerConfiguration(LoaderInterface $loader)
{
parent::registerContainerConfiguration($loader);

if (getenv('SYMFONY__PHPCR__TRANSPORT') === 'jackrabbit') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a better (and fastly implementable) idea how to solve this. It's about enabling versioning only for jackrabbit... A solution might be to add another environment variable. Would allow us to also test jackrabbit without versioning. Then we would have another build more, and the tests are taking longer, ... I think I would leave it like that.

/**
* Responsible for integrating the security part of Sulu to the DocumentManager.
*/
class SecuritySubscriber implements EventSubscriberInterface
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This subscriber makes detecting the user more reusable. It's always set as an option, so that it can be reused in all the different events.

@danrot danrot force-pushed the feature/versioning branch 2 times, most recently from 08270b4 to 81d7d6c Compare January 18, 2017 14:43
@danrot danrot force-pushed the feature/versioning branch 2 times, most recently from a13d0e6 to cf210af Compare January 25, 2017 14:15
@chirimoya
Copy link
Member

@danrot ready to merge?

@danrot
Copy link
Contributor Author

danrot commented Jan 26, 2017

@chirimoya yes 😃

@danrot danrot added this to the Release 1.5 milestone Jan 26, 2017
@chirimoya chirimoya merged commit ac6f6c6 into sulu:develop Jan 31, 2017
@danrot danrot deleted the feature/versioning branch January 31, 2017 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add publisher for settings tab changelog
2 participants