Skip to content

Commit

Permalink
EZP-29269: User draft is not discarded on edition cancel (ezsystems#240)
Browse files Browse the repository at this point in the history
* EZP-29269: User draft is not discarded on edition cancel

* EZP-29269: User draft is not discarded on edition cancel - remove repository dependency

* EZP-29269: Introducing new route for user handling

* EZP-29269: Fixing behat tests

* EZP-29269: fixed change list

* EZP-29269: exposed ez_user_update route
  • Loading branch information
ViniTou authored and Łukasz Serwatka committed Sep 21, 2018
1 parent f419d85 commit 23bb2ff
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 142 deletions.
9 changes: 6 additions & 3 deletions bundle/Resources/config/routing.yml
Expand Up @@ -37,11 +37,14 @@ ez_user_register_confirmation:
_controller: "ezrepoforms.controller.user_register:registerConfirmAction"

ez_user_create:
path: /user/create
path: /user/create/{contentTypeIdentifier}/{language}/{parentLocationId}
defaults:
_controller: "ezrepoforms.controller.user:createAction"

ez_user_update:
path: /user/update
path: /user/update/{contentId}/{versionNo}/{language}
defaults:
_controller: "ezrepoforms.controller.user:updateAction"
_controller: "ezrepoforms.controller.user:editAction"
options:
expose: true

10 changes: 0 additions & 10 deletions bundle/Resources/config/services.yml
Expand Up @@ -50,7 +50,6 @@ parameters:
ezrepoforms.user_register.registration_group_loader.configurable.class: EzSystems\RepositoryForms\User\ConfigurableRegistrationGroupLoader
ezrepoforms.user_register.registration_content_type_loader.configurable.class: EzSystems\RepositoryForms\User\ConfigurableRegistrationContentTypeLoader
ezrepoforms.view_templates_listener.class: EzSystems\RepositoryForms\EventListener\ViewTemplatesListener
ezrepoforms.user_edit_listener.class: EzSystems\RepositoryForms\EventListener\UserEditListener

ezrepoforms.form_data_mapper.user_register.class: EzSystems\RepositoryForms\Data\Mapper\UserRegisterMapper

Expand Down Expand Up @@ -314,15 +313,6 @@ services:
- [setViewTemplate, ['EzSystems\RepositoryForms\Content\View\ContentCreateDraftView', "$content_edit.templates.create_draft$"]]
- [setPagelayout, ["$pagelayout$"]]

ezrepoforms.user_edit_listener:
class: "%ezrepoforms.user_edit_listener.class%"
arguments:
- "@ezpublish.api.service.content_type"
- "@ezpublish.api.service.content"
- "@ezrepoforms.controller.user"
tags:
- { name: kernel.event_subscriber }

ezrepoforms.translation.extractor.sorting:
class: EzSystems\RepositoryForms\Translation\SortingTranslationExtractor
tags:
Expand Down
11 changes: 11 additions & 0 deletions doc/bc/changes-2.3.md
@@ -0,0 +1,11 @@
# Backwards compatibility changes

Changes affecting version compatibility with former or future versions.

## Removed features

- EZP-29269: Editing content with user content field no longer results with draft creation.

As part of it :
- `\EzSystems\RepositoryForms\EventListener\UserEditListener` was removed
- Existing routes `ez_user_create` and `ez_user_update` were changed in order to comply with new flow
4 changes: 2 additions & 2 deletions features/FieldTypeForm/user_fieldtype_edit_form.feature
Expand Up @@ -7,7 +7,7 @@ Background:
Given a Content Type with a user field definition

Scenario: The attributes of a user field have a form representation
When I view the edit form for this field
When I view the edit user form for this field
Then the edit form should contain an identifiable widget for user field definition
And it should contain the following set of labels, and input fields of the following types:
| label | type |
Expand All @@ -18,5 +18,5 @@ Scenario: The attributes of a user field have a form representation

Scenario: The input fields are flagged as required when the field definition is required
Given the field definition is marked as required
When I view the edit form for this field
When I view the edit user form for this field
Then the value input fields for user field should be flagged as required
15 changes: 14 additions & 1 deletion lib/Behat/Context/FieldTypeFormContext.php
Expand Up @@ -86,6 +86,19 @@ public function iEditOrCreateContentOfThisType()
);
}

/**
* @When /^I view the edit user form for this field$/
*/
public function iEditOrCreateContentOfUserType()
{
$this->visitPath(
sprintf(
'/user/create/%s/eng-GB/2',
$this->contentTypeContext->getCurrentContentType()->identifier
)
);
}

/**
* @Then the edit form should contain an identifiable widget for :fieldTypeIdentifier field definition
*/
Expand Down Expand Up @@ -156,7 +169,7 @@ public function theFieldDefinitionIsMarkedAsRequired()
/**
* @Then the value input fields for :fieldIdentifier field should be flagged as required
*/
public function theInputFieldsShouldBeFlaggedAsRequired($fieldTypeIdentifier)
public function theInputFieldsShouldBeFlaggedAsRequired(string $fieldTypeIdentifier)
{
$inputNodeElements = $this->getSession()->getPage()->findAll(
'css',
Expand Down
126 changes: 0 additions & 126 deletions lib/EventListener/UserEditListener.php

This file was deleted.

0 comments on commit 23bb2ff

Please sign in to comment.