[LIVECOPY-288] Protect Button saves wrong protection names if a locale is a default in a tree but not the master default Created: 31/Aug/21 Updated: 20/Sep/21 Resolved: 17/Sep/21 |
|
| Status: | Closed |
| Project: | Live Copy |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 3.2.6 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Marvin Kerkhoff | Assignee: | Quach Hao Thien |
| Resolution: | Done | Votes: | 0 |
| Labels: | VN-Analysis, VN-Maintenance, cm-team-support, maintenance | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 6d 1.5h | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| Template: | |||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
||||
| Release notes required: |
Yes
|
||||
| Documentation update required: |
Yes
|
||||
| Date of First Response: | |||||
| Epic Link: | Live Copy maintenance | ||||
| Sprint: | Content Mngmt 12, Content Mngmt 13 | ||||
| Story Points: | 5 | ||||
| Description |
|
Protect Button saves wrong protection names if a locale is a default in a tree but not the master default. Steps to reproduce
Expected resultsBecause en_GB is not the master default locale the en_GB should be saved as suffix Actual resultsIt will create a <propertyName> in the protectedFields property without language suffix. Development notesThe issue is in the Button: It uses an own implementation of isDefaultLocale at line 102. Instead you should use the isDefaultLocale method from https://git.magnolia-cms.com/projects/ADDON/repos/live-copy/browse/src/main/java/info/magnolia/livecopy/i18n/LiveCopyMultiSiteI18nAuthoringSupport.java |
| Comments |
| Comment by Quach Hao Thien [ 01/Sep/21 ] |
|
hi marvink2, could you please provide the resources as master page, slave pages, site definition for each page that would help to understand more the issue you are encountering? |
| Comment by Marvin Kerkhoff [ 01/Sep/21 ] |
|
Hi Quach, sorry i am not able to extract a quick example. But the issue is very simple. You are using a different logical implementation in the set protect fields method as you do by getting the default locale in the push methods. So you should set the default locale implementation to the one at the LiveCopyMultiSiteI18nAuthoringSupport. It was extra developed for this purpose. You could reproduce the issue by creating the trees as following:
And here you already see the implementation issue. Your implementaiton in the button uses the fallback locale of step 5. But it should use the masterDefaultLocale from Step 4. This is what the LiveCopyMultiSiteI18nAuthoringSupport method is doing. |
| Comment by Quach Hao Thien [ 01/Sep/21 ] |
|
just double check: 4. Add en_US as masterDefaultLocale > should be masterLocale instead |
| Comment by Marvin Kerkhoff [ 01/Sep/21 ] |
|
yes, sorry |
| Comment by Quach Hao Thien [ 06/Sep/21 ] |
|
Hi marvink2, sorry for late response, I was on holiday. does this site definition below describe best your slave page?
|
| Comment by Marvin Kerkhoff [ 07/Sep/21 ] |
|
Welcome back. masterLocale = en_US defaultLocale need to be en_GB fallbackLocale = en_GB
In the time where Jan and i have developed the module together we came across this stupid issue. It seems that there is a weird configuration. In some cases defaultLocale is used and in some fallbackLocale. The problem becomes even more difficult if you have a slave site configuration where you have no en_US Locale at all. |
| Comment by Quach Hao Thien [ 07/Sep/21 ] |
|
I found a problem with masterLocale. the masterLocale datatype actually is a String, https://git.magnolia-cms.com/projects/ADDON/repos/live-copy/browse/src/main/java/info/magnolia/livecopy/i18n/LiveCopyI18nContentSupport.java#39, whereas the defaultLocale, or fallbackLocale have datatype as Locale. And when it is converted to Locale https://git.magnolia-cms.com/projects/ADDON/repos/live-copy/browse/src/main/java/info/magnolia/livecopy/i18n/LiveCopyMultiSiteI18nAuthoringSupport.java#54 the Locale masterLocale = new Locale(masterLocaleString); will return a Locale with language "en_US", this is an invalid one, we expect to have a Locale with language as en and country as US. Therefore it cannot be used to check the default locale of slave page. To fix this issue, there are 2 ways:
I'm really appreciate if you could try one of these method above, and see if it works for you. "In the time where Jan and i have developed the module together we came across this stupid issue. It seems that there is a weird configuration. In some cases defaultLocale is used and in some fallbackLocale. The problem becomes even more difficult if you have a slave site configuration where you have no en_US Locale at all." -> Indeed, there is no document about the defaultLocale, but as I investigated, the fallbackLocale is used only the defaultLocale is missing, therefore in any case we should prioritize defining defaultLocale. |