Adoxio / xRM-Portals-Community-Edition

The definitive edition of Microsoft Open Source Portals, supported by the experts in portals.
MIT License
107 stars 60 forks source link

Output Cache Profiles are not all language friendly #74

Closed jliberta closed 6 years ago

jliberta commented 6 years ago

Hi,

I noticed something in the code, LayoutController.cs which renders headers, primary navigation, weblinks, etc, the ActionResult functions that use Donut Caching and have cache profiles set to either Roles, or RolesShared do not get cached based on language. As this new version of the portal contains heavy changes on localization, HeaderChildNavbar(), HeaderPrimaryNavigation(), HeaderPrimaryNavigationTabs(), HeaderPrimaryNavigationXs() do not get cached based on language so our portal which is in both English and French would render these views in English only.

I have found a solution that involves adding a language parameter to the output cache profiles in web config, as well as modifying the Global.ascx.cs file to support this new parameter and it is working.

Any idea where I can contribute to the community and have it tested?

amervitz commented 6 years ago

A pull request can be sent to this project. First though, are you running the latest code from this project? If so, please describe steps taken to reproduce the problem. I so far am unable to reproduce this issue.

jliberta commented 6 years ago

Yes we are, we have set up a portal in D365 using both English 1033 and French 1036.

We have a weblink set for English and one translated for French, it is titled "Primary Navigation". This weblink set is rendered using HeaderPrimaryNavigation.ascx.

In the portal its loads the primary navigation in English, and when we switch to French the primary navigation does not switch to French because its cache profile is set to "RolesShared".

amervitz commented 6 years ago

Where did the data for your portal originate from? Is it from one of the included samples or are you using your own data from an Adxstudio Portals implementation that has been upgraded?

jliberta commented 6 years ago

The second method, we imported the upgrade solution and used the latest version of the code, we've made sure that the web links were set up properly and pointing to the correct English and French languages of the website.

amervitz commented 6 years ago

Which page template are you using to reproduce this?

jliberta commented 6 years ago

The page template is a regular one, but it points to a custom ASPX page in the community edition solution, therefore the page responsible for rendering the header is Default.master

amervitz commented 6 years ago

Do you have the output cache directive set in the aspx page? If so, what value is being used?

jliberta commented 6 years ago

There are no output cache directives in the aspx page

jliberta commented 6 years ago

The thing that is somewhat weird is that I don't know why the output cache profiles defined in the web config for Roles and RolesShared wouldn't cache based on context language as the User and UserShared profiles are currently doing. I mean it is entirely possible that primary navigation bars based on user roles are subject to language changes right?

amervitz commented 6 years ago

Your reasoning is sound, and I have been able to reproduce this too now. Please submit a pull request with your changes. Thank you!

jliberta commented 6 years ago

I have created a branch that contains the fix for this issue, when I try to create a pull request from this branch in visual studio I get a 403 error. Am I doing something wrong or do you need to explicitly give me access to creating a branch and pull request?

amervitz commented 6 years ago

Please refer to https://help.github.com/articles/creating-a-pull-request/#creating-the-pull-request.

jliberta commented 6 years ago

It won't let me create a pull request without specifying the branch I created, and when creating a branch I get a 403 error

amervitz commented 6 years ago

It sounds like you haven't forked the project, see https://guides.github.com/activities/forking/.

amervitz commented 6 years ago

Closed by commit https://github.com/Adoxio/xRM-Portals-Community-Edition/commit/ecda8fbbd2540e9cc1e636a6bb0bffad6829f895.