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

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

Merged
mikadamczyk merged 5 commits into
1.5from
ibx-862-translate-action-secondary-location
Sep 6, 2021
Merged

mikadamczyk merged 5 commits into
1.5from
ibx-862-translate-action-secondary-location

Conversation

@barw4

@barw4 barw4 commented Aug 10, 2021 •

Copy link
Copy Markdown
Member
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

@mikadamczyk mikadamczyk left a comment

Copy link
Copy Markdown
Contributor

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

arfaram commented Aug 10, 2021 •

Copy link
Copy Markdown
Contributor

Comment thread src/bundle/Resources/config/routing.yml Outdated

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

Copy link
Copy Markdown
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
Copy Markdown
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.

@barw4 barw4 Aug 13, 2021 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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.

Comment thread src/bundle/Resources/config/routing.yml Outdated

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

Copy link
Copy Markdown
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?

Comment thread src/bundle/Resources/config/routing.yml Outdated
@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
Comment thread src/bundle/Resources/config/routing.yml Outdated
path: /content/{contentId}/location/{locationId}/translate/{toLanguageCode}/{fromLanguageCode}
methods: ['GET', 'POST']
defaults:
_controller: 'EzPlatformAdminUiBundle:ContentEdit:translate'

Copy link
Copy Markdown
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

adamwojs commented Sep 6, 2021

Copy link
Copy Markdown
Member

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

Comment thread src/bundle/Resources/config/routing.yml Outdated
@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2021

Copy link
Copy Markdown

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
Copy Markdown
Contributor

Could you merge it up @barw4 ?

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

barw4 commented Sep 9, 2021 •

Copy link
Copy Markdown
Member Author

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

Follow-up PR for branch 2.3 made separately:

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

Development

Successfully merging this pull request may close these issues.

8 participants