advanced-cms / advanced-reviews

This is an Open Source add-on that improves the reviewing process and lets external users to view & review content items or whole projects without the need to access the Edit Mode. Created and maintained by Bartosz Sekuła and Grzegorz Wiecheć
Apache License 2.0
17 stars 15 forks source link

View & Edit link shows English content version when creating in another language version #221

Closed nguyenminhvuong closed 1 year ago

nguyenminhvuong commented 2 years ago

Steps:

Expected:

External view or edit URL show content of current language version

Actual:

It shows the content of the English version.

Installed packages: Episerver.Labs.LanguageManager - 5.1.1 Episerver.CMS.UI - 12.10.0 Episerver.CMS - 12.8.0 Episerver.CMS.AspNetCore - 12.8.0

barteksekula commented 2 years ago

available in https://nuget.optimizely.com/package/?id=Advanced.CMS.AdvancedReviews&v=1.2.1

nguyenminhvuong commented 2 years ago

@barteksekula I tested on the Alloy site. The issue still occurs. Could you please check again

barteksekula commented 2 years ago

Maybe we are missing something here. This is what I'm doing: https://user-images.githubusercontent.com/1321664/200661212-ed3ea930-4ff9-42c8-ad39-7e78c47037f5.mp4

barteksekula commented 2 years ago

The bug only happened when PinSecurity was turned on, I think that was the reason why we were not able to communicate properly. Anyway, if that was the case for you then the issue was fixed in both .net core https://nuget.optimizely.com/package/?id=Advanced.CMS.AdvancedReviews&v=1.2.2 and in .net framework https://nuget.optimizely.com/package/?id=Advanced.CMS.AdvancedReviews&v=0.9.2

nguyenminhvuong commented 1 year ago

@barteksekula I found the root cause of the issue. It happens when I do not create a language version of a start page.

Step to re-procedure in Alloy:

  1. Go to admin mode & select a start page.
  2. Remove another language version of it (keep Eng only)
  3. Go to another page and create a language version for it
  4. Create an external content view for the language version in step 3
  5. Go to the URL --> 404 error (in my project, it returns a master language version because we a logic to return the master language if the content is not available)

This is my workaround for my project:

  1. Overwrite PagePreviewPartialRouter.cs
  2. Remove _contentLanguageAccessor.Language = new CultureInfo(content.LanguageBranch()); in line 65

I also found another issue when viewing the page in a review mode. In my case, we force to change all URLs to lowercase; then when going to review mode, it returns a blank page. Because in PageEditPartialRouter.cs, nextSegment.Next.ToString() != _externalReviewOptions.ContentIframeEditUrlSegment return false. It should compare ignored case.

barteksekula commented 1 year ago

True, reopening.