Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

[WIP] EZP-27870: Remove translation of every versions of a content #919

Closed

Conversation

StephaneDiot
Copy link
Contributor

@StephaneDiot StephaneDiot commented Nov 13, 2017

[WIP]

First draft for https://jira.ez.no/browse/EZP-27914

Waiting for API REST to be updated (and JS REST client but I guess I'll do it)

@ezrobot
Copy link

ezrobot commented Nov 13, 2017

Tool version : jshint v2.9.5
jshint with our configuration reports the following issues:

Command executed : jshint -c jshint.json --verbose Resources/public/js/views/services/ez-locationviewviewservice.js, output :

Resources/public/js/views/services/ez-locationviewviewservice.js: line 516, col 17, 'loadOptions' is defined but never used. (W098)

1 error

Command executed : jshint -c jshint.json --verbose Resources/public/js/views/actions/ez-translateactionview.js, output :

Resources/public/js/views/actions/ez-translateactionview.js: line 165, col 14, Missing semicolon. (W033)

1 error

@ezrobot
Copy link

ezrobot commented Nov 13, 2017

Tool version : PHP CS Fixer 2.7.1 Sandy Pool by Fabien Potencier and Dariusz Ruminski
Command executed php-cs-fixer --dry-run -v fix
This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

diff --git a/ApplicationConfig/Providers/InterfaceLanguages.php b/ApplicationConfig/Providers/InterfaceLanguages.php
index ab8768d..89b6f57 100644
--- a/ApplicationConfig/Providers/InterfaceLanguages.php
+++ b/ApplicationConfig/Providers/InterfaceLanguages.php
@@ -28,7 +28,7 @@ class InterfaceLanguages implements Provider
         $defaultLocale = $request->getDefaultLocale();
 
         $languages = [$browserLanguage];
-        if (strpos($browserLanguage, '_') !== false) {
+        if (false !== strpos($browserLanguage, '_')) {
             $languages[] = explode('_', $browserLanguage)[0];
         }
         if (!in_array($defaultLocale, $languages)) {
diff --git a/Controller/Rest/ContentController.php b/Controller/Rest/ContentController.php
index 21d0284..330c392 100644
--- a/Controller/Rest/ContentController.php
+++ b/Controller/Rest/ContentController.php
@@ -119,12 +119,12 @@ class ContentController extends Content
 
     private function isUserCreateRequest(Request $request)
     {
-        if (($contentTypeHeaderValue = $request->headers->get('Content-Type')) == null) {
+        if (null == ($contentTypeHeaderValue = $request->headers->get('Content-Type'))) {
             return false;
         }
 
         list($mediaType) = explode('+', $contentTypeHeaderValue);
-        if (strtolower($mediaType) !== 'application/vnd.ez.api.contentcreate') {
+        if ('application/vnd.ez.api.contentcreate' !== strtolower($mediaType)) {
             return false;
         }
 
diff --git a/Controller/TemplateController.php b/Controller/TemplateController.php
index 6639916..3e43565 100644
--- a/Controller/TemplateController.php
+++ b/Controller/TemplateController.php
@@ -41,7 +41,7 @@ class TemplateController extends Controller
      */
     public function wrapTemplateAction($module)
     {
-        if ($this->getModuleSetting($module, 'type') !== 'template') {
+        if ('template' !== $this->getModuleSetting($module, 'type')) {
             throw new BadRequestHttpException($module . ' is not declared as a template');
         }
         $path = $this->getModuleSetting($module, 'path');
diff --git a/Features/Context/Fields.php b/Features/Context/Fields.php
index a6c2cc2..1766fb5 100644
--- a/Features/Context/Fields.php
+++ b/Features/Context/Fields.php
@@ -53,7 +53,7 @@ class Fields extends PlatformUI
         $identifier = $fieldManager->getThisFieldTypeIdentifier();
 
         // check if we are editing a field for draft or published content
-        if ($fieldManager->getFieldContentState() == FieldType::CONTENT_PUBLISHED) {
+        if (FieldType::CONTENT_PUBLISHED == $fieldManager->getFieldContentState()) {
             $contentId = $fieldManager->getThisContentId();
         } else {
             $contentId = '';
@@ -121,7 +121,7 @@ class Fields extends PlatformUI
      */
     public function checkFieldValue()
     {
-        if ($this->platformStatus == self::WAITING_FOR_PUBLISHING) {
+        if (self::WAITING_FOR_PUBLISHING == $this->platformStatus) {
             $this->checkOption($this->getThisFieldIdent());
         } else {
             throw new \Exception('Cannot publish content, application in wrong state');
@@ -134,7 +134,7 @@ class Fields extends PlatformUI
      */
     public function uncheckFieldValue()
     {
-        if ($this->platformStatus == self::WAITING_FOR_PUBLISHING) {
+        if (self::WAITING_FOR_PUBLISHING == $this->platformStatus) {
             $this->uncheckOption($this->getThisFieldIdent());
         } else {
             throw new \Exception('Cannot publish content, application in wrong state');
@@ -147,7 +147,7 @@ class Fields extends PlatformUI
      */
     public function publishContent()
     {
-        if ($this->platformStatus == self::WAITING_FOR_PUBLISHING) {
+        if (self::WAITING_FOR_PUBLISHING == $this->platformStatus) {
             $this->clickEditActionBar('Publish');
         } else {
             throw new \Exception('Cannot publish content, application in wrong state');
@@ -161,7 +161,7 @@ class Fields extends PlatformUI
      */
     public function seeRequiredFieldtOfType($label)
     {
-        if ($this->platformStatus == self::WAITING_FOR_PUBLISHING) {
+        if (self::WAITING_FOR_PUBLISHING == $this->platformStatus) {
             $fieldManager = $this->getFieldTypeManager();
             // $type = ...
             //$name = $fieldManager->getThisFieldTypeName();
@@ -206,7 +206,7 @@ class Fields extends PlatformUI
      */
     public function seeFieldtOfType($type, $label = null)
     {
-        if ($this->platformStatus == self::WAITING_FOR_PUBLISHING) {
+        if (self::WAITING_FOR_PUBLISHING == $this->platformStatus) {
             $this->clickEditActionBar('Publish');
         }
         $verification = new WebAssert($this->getSession());
@@ -214,7 +214,7 @@ class Field(...)

NOTICE : Report truncated to 5Kb

@adamwojs
Copy link
Member

adamwojs commented Feb 8, 2018

Closed in favor of #949

@adamwojs adamwojs closed this Feb 8, 2018
@andrerom andrerom deleted the EZP-27870_Remove_translation_from_content branch February 8, 2018 15:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants