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

LPS-57883 #31214

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -90,7 +90,6 @@
import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.util.PrefsPropsUtil;
import com.liferay.portal.util.PropsValues;
import com.liferay.portal.util.SessionClicks;
import com.liferay.portal.util.WebKeys;
import com.liferay.portlet.PortalPreferences;
import com.liferay.portlet.PortletPreferencesFactoryUtil;
Expand Down Expand Up @@ -120,6 +119,7 @@
import com.liferay.portlet.exportimport.service.ExportImportConfigurationLocalServiceUtil;
import com.liferay.portlet.exportimport.service.StagingLocalServiceUtil;
import com.liferay.portlet.exportimport.staging.LayoutStagingUtil;
import com.liferay.portlet.exportimport.staging.ProxiedLayoutsThreadLocal;
import com.liferay.portlet.exportimport.staging.Staging;
import com.liferay.portlet.exportimport.staging.StagingConstants;

Expand Down Expand Up @@ -1024,10 +1024,23 @@ public long getRecentLayoutRevisionId(
public long getRecentLayoutSetBranchId(
HttpServletRequest request, long layoutSetId) {

return GetterUtil.getLong(
SessionClicks.get(
request, Staging.class.getName(),
getRecentLayoutSetBranchIdKey(layoutSetId)));
PortalPreferences portalPreferences =
PortletPreferencesFactoryUtil.getPortalPreferences(request);

try {
return getRecentLayoutAttribute(
portalPreferences, getRecentLayoutSetBranchIdKey(layoutSetId));
}
catch (JSONException jsone) {
if (_log.isWarnEnabled()) {
_log.warn(
"Unable to get recent layout set branch ID layout set " +
layoutSetId,
jsone);
}
}

return 0;
}

@Override
Expand Down Expand Up @@ -1646,10 +1659,25 @@ public void setRecentLayoutRevisionId(
public void setRecentLayoutSetBranchId(
HttpServletRequest request, long layoutSetId, long layoutSetBranchId) {

SessionClicks.put(
request, Staging.class.getName(),
getRecentLayoutSetBranchIdKey(layoutSetId),
String.valueOf(layoutSetBranchId));
PortalPreferences portalPreferences =
PortletPreferencesFactoryUtil.getPortalPreferences(request);

try {
setRecentLayoutAttribute(
portalPreferences, getRecentLayoutSetBranchIdKey(layoutSetId),
layoutSetBranchId);

ProxiedLayoutsThreadLocal.clearProxiedLayouts();
}
catch (JSONException jsone) {
if (_log.isWarnEnabled()) {
_log.warn(
"Unable to set recent layout set branch ID with layout " +
"set " + layoutSetId + " and layout set branch " +
layoutSetBranchId,
jsone);
}
}
}

@Override
Expand All @@ -1662,6 +1690,8 @@ public void setRecentLayoutSetBranchId(
setRecentLayoutAttribute(
portalPreferences, getRecentLayoutSetBranchIdKey(layoutSetId),
layoutSetBranchId);

ProxiedLayoutsThreadLocal.clearProxiedLayouts();
}
catch (JSONException jsone) {
if (_log.isWarnEnabled()) {
Expand Down Expand Up @@ -2390,6 +2420,8 @@ protected void setRecentLayoutBranchId(
portalPreferences,
getRecentLayoutBranchIdKey(layoutSetBranchId, plid),
layoutBranchId);

ProxiedLayoutsThreadLocal.clearProxiedLayouts();
}
catch (JSONException jsone) {
if (_log.isWarnEnabled()) {
Expand Down
Expand Up @@ -88,6 +88,8 @@ PortletURL currentURLObj = PortletURLUtil.getCurrent(liferayPortletRequest, life

String currentURL = currentURLObj.toString();

layout = LayoutLocalServiceUtil.fetchLayout(plid);

Layout selLayout = layout;

long selPlid = ParamUtil.getLong(request, "selPlid");
Expand Down