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

IBX-862: Fixed translation action originating from non-main Location #1845

Merged
merged 5 commits into from
Sep 6, 2021

Conversation

barw4
Copy link
Member

@barw4 barw4 commented Aug 10, 2021

Question Answer
Tickets IBX-862
Bug fix? yes
New feature? no
BC breaks? no
Tests pass? yes
Doc needed? no
License GPL-2.0

The locationId parameter has been added to translate action in order for redirect after the translation to work properly.

Checklist:

  • Coding standards ($ composer fix-cs)
  • Ready for Code Review

@barw4 barw4 requested a review from a team August 10, 2021 11:20
@barw4 barw4 self-assigned this Aug 10, 2021
Copy link
Contributor

@mikadamczyk mikadamczyk left a comment

Choose a reason for hiding this comment

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

@mikadamczyk mikadamczyk requested a review from a team August 10, 2021 11:30
@arfaram
Copy link
Contributor

arfaram commented Aug 10, 2021

@@ -564,7 +564,7 @@ ezplatform.content.preview:
locationId: ~

ezplatform.content.translate:
path: /content/{contentId}/translate/{toLanguageCode}/{fromLanguageCode}
path: /content/{contentId}/{locationId}/translate/{toLanguageCode}/{fromLanguageCode}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't remember if we gave BC promise on route parameters. If so it's a BC break, if not, then it's fine
POV ping @ezsystems/php-dev-team

Copy link
Contributor

Choose a reason for hiding this comment

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

I am sure we do (or at least did in the past ;) ), as we also did not rename controllers method parameters because of that. Thats why it should have default value and same behavior as current with it.

Copy link
Member Author

@barw4 barw4 Aug 13, 2021

Choose a reason for hiding this comment

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

@alongosz, @ViniTou in this case we won't be able to fix this one as we need the locationId in order for the proper location to be loaded when translating. Right now this is a decision if we want to keep the BC or fix this.

Copy link
Member

Choose a reason for hiding this comment

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

@alongosz, @ViniTou in this case we won't be able to fix this one as we need the locationId in order for the proper location to be loaded when translating. Right now this is a decision if we want to keep the BC or fix this.

@barw4 Usually I'd encourage you to find on your own a solution which provides both, but since this is CSR, let me just serve it.
There are 2 ways of providing BC for the route itself:

A) New route:

  1. Create different route
  2. Use different route where needed
  3. If the old route is not needed everywhere, deprecate (if no route deprecation is available, simple place a deprecating comment)

B) Default parameter

  1. Place {locationId} at the end instead
  2. Provide default value via defaults route attribute

Question: I don't see consumption changes, only passing the parameter. Where is it used?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

The default parameter option was not possible as we had the other default parameter at the end.

@@ -564,7 +564,7 @@ ezplatform.content.preview:
locationId: ~

ezplatform.content.translate:
path: /content/{contentId}/translate/{toLanguageCode}/{fromLanguageCode}
path: /content/{contentId}/{locationId}/translate/{toLanguageCode}/{fromLanguageCode}
Copy link
Member

Choose a reason for hiding this comment

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

@alongosz, @ViniTou in this case we won't be able to fix this one as we need the locationId in order for the proper location to be loaded when translating. Right now this is a decision if we want to keep the BC or fix this.

@barw4 Usually I'd encourage you to find on your own a solution which provides both, but since this is CSR, let me just serve it.
There are 2 ways of providing BC for the route itself:

A) New route:

  1. Create different route
  2. Use different route where needed
  3. If the old route is not needed everywhere, deprecate (if no route deprecation is available, simple place a deprecating comment)

B) Default parameter

  1. Place {locationId} at the end instead
  2. Provide default value via defaults route attribute

Question: I don't see consumption changes, only passing the parameter. Where is it used?

@alongosz alongosz requested a review from ViniTou September 1, 2021 09:24
@alongosz alongosz changed the title IBX-862: Translation action originating from chosen location IBX-862: Fixed translation action originating from non-main Location Sep 1, 2021
@bogusez bogusez self-assigned this Sep 6, 2021
path: /content/{contentId}/location/{locationId}/translate/{toLanguageCode}/{fromLanguageCode}
methods: ['GET', 'POST']
defaults:
_controller: 'EzPlatformAdminUiBundle:ContentEdit:translate'
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this a legacy way of referencing controllers?

Using FQCN is recommended afaik.

@adamwojs
Copy link
Member

adamwojs commented Sep 6, 2021

@barw4 Could you please apply #1845 (comment) suggestion before merge ?

@sonarcloud
Copy link

sonarcloud bot commented Sep 6, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mikadamczyk mikadamczyk merged commit 8687bf1 into 1.5 Sep 6, 2021
@mikadamczyk
Copy link
Contributor

Could you merge it up @barw4 ?

@mikadamczyk mikadamczyk deleted the ibx-862-translate-action-secondary-location branch September 6, 2021 13:34
@barw4
Copy link
Member Author

barw4 commented Sep 9, 2021

Merged (empty commit) to:
2.3: e436c4d
master: 6a6eb37

Follow-up PR for branch 2.3 made separately:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

8 participants