Skip to content

Commit

Permalink
fix: Preserve Data when duplicating SNV Portlet - MEED-7687 - Meeds-i…
Browse files Browse the repository at this point in the history
…o/MIPs#165 (#1188)

Prior to this change, when the SNV Portlet doesn't have been
initialized/displayed yet in a page, like the default Space Templates,
the 'data.init' preference isn't used to initialize the portlet yet and
thus when duplicating the page template, the 'data.init' has to be
reused instead of generated only when the CMS portlet is initialized.
  • Loading branch information
boubaker committed Oct 30, 2024
1 parent 26c1d26 commit 50faac7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ public String getPortletName() {
public List<PortletInstancePreference> generatePreferences(Application application, Portlet preferences) {
String settingName = getCmsSettingName(preferences);
if (StringUtils.isBlank(settingName)) {
return Collections.emptyList();
if (preferences != null && preferences.getPreference(DATA_INIT_PREFERENCE_NAME) != null) {
return Collections.singletonList(new PortletInstancePreference(DATA_INIT_PREFERENCE_NAME,
preferences.getPreference(DATA_INIT_PREFERENCE_NAME)
.getValue()));
} else {
return Collections.emptyList();
}
}
NotePageData notePageData = notePageViewService.getNotePageData(settingName);
return Collections.singletonList(new PortletInstancePreference(DATA_INIT_PREFERENCE_NAME,
Expand Down

0 comments on commit 50faac7

Please sign in to comment.