From b3d3c6d5e15eb3996213f313c5dcfd7309f78bac Mon Sep 17 00:00:00 2001 From: Samantha Fisher Date: Thu, 7 May 2020 10:23:01 +1000 Subject: [PATCH 1/3] Surround initilise page function with viewable check To ensure metadata attributed to hidden pages is not wiped by the mandatory field check. --- .../src/com/tle/web/wizard/section/RootWizardSection.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java index 25d950a655..5911735849 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java @@ -305,6 +305,11 @@ void validateMandatoryFields(SectionInfo info, WizardState state) { PagesSection ps = info.lookupSection(PagesSection.class); wizardService .getWizardPages(state) - .forEach(p -> wizardService.ensureInitialisedPage(info, p, ps.getReloadFunction(), true)); + .forEach( + p -> { + if (p.isViewable()) { + wizardService.ensureInitialisedPage(info, p, ps.getReloadFunction(), true); + } + }); } } From 0785e0c7f1d13c0df7ac983eb74d9f55275aa2c6 Mon Sep 17 00:00:00 2001 From: SammyIsConfused Date: Thu, 7 May 2020 11:35:28 +1000 Subject: [PATCH 2/3] Make viewable check a filter rather than an if statement Co-authored-by: edalex-ian <43919233+edalex-ian@users.noreply.github.com> --- .../src/com/tle/web/wizard/section/RootWizardSection.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java index 5911735849..b9e8d40e8f 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java @@ -305,11 +305,7 @@ void validateMandatoryFields(SectionInfo info, WizardState state) { PagesSection ps = info.lookupSection(PagesSection.class); wizardService .getWizardPages(state) - .forEach( - p -> { - if (p.isViewable()) { - wizardService.ensureInitialisedPage(info, p, ps.getReloadFunction(), true); - } - }); + .stream().filter(WebWizardPage::isViewable) + .forEach(p -> wizardService.ensureInitialisedPage(info, p, ps.getReloadFunction(), true)); } } From f786b71e48fb4d7d28ee5efa6ab65c9cd1c225d8 Mon Sep 17 00:00:00 2001 From: Samantha Fisher Date: Thu, 7 May 2020 11:36:58 +1000 Subject: [PATCH 3/3] Add import statement for WebWizardPage --- .../src/com/tle/web/wizard/section/RootWizardSection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java index b9e8d40e8f..54e291b82f 100644 --- a/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java +++ b/Source/Plugins/Core/com.equella.core/src/com/tle/web/wizard/section/RootWizardSection.java @@ -54,6 +54,7 @@ import com.tle.web.template.Decorations; import com.tle.web.template.Decorations.MenuMode; import com.tle.web.viewurl.ItemSectionInfo; +import com.tle.web.wizard.WebWizardPage; import com.tle.web.wizard.WizardExceptionHandler; import com.tle.web.wizard.WizardService; import com.tle.web.wizard.WizardState; @@ -303,9 +304,8 @@ protected WizardSectionInfo getWizardInfo(SectionInfo info) { void validateMandatoryFields(SectionInfo info, WizardState state) { PagesSection ps = info.lookupSection(PagesSection.class); - wizardService - .getWizardPages(state) - .stream().filter(WebWizardPage::isViewable) + wizardService.getWizardPages(state).stream() + .filter(WebWizardPage::isViewable) .forEach(p -> wizardService.ensureInitialisedPage(info, p, ps.getReloadFunction(), true)); } }