Skip to content

Commit

Permalink
SAK-50162 SiteInfo avoid failure when creating site from template (sa…
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored May 29, 2024
1 parent 3b3348b commit 7bc8da7
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2764,20 +2764,19 @@ else if (state.getAttribute(STATE_CM_REQUESTED_SECTIONS) != null) {
} else {
// In the site creation process...
siteInfo = (SiteInfo) state.getAttribute(STATE_SITE_INFO);
// the template site, if using one
Site templateSite = (Site) state.getAttribute(STATE_TEMPLATE_SITE);

if (siteInfo.site_type != null
&& publicChangeableSiteTypes
.contains(siteInfo.site_type)) {
if (siteInfo.site_type != null && publicChangeableSiteTypes.contains(siteInfo.site_type)) {
context.put("publicChangeable", Boolean.TRUE);
} else {
context.put("publicChangeable", Boolean.FALSE);
}
context.put("include", Boolean.valueOf(siteInfo.getInclude()));

// If this site is a course site, publish if we're inside the term dates
if (siteInfo.site_type != null && SiteTypeUtil.isCourseSite(siteInfo.site_type)) {
AcademicSession academicSession
= courseManagementService.getAcademicSession(siteInfo.term);
if (siteInfo.site_type != null && SiteTypeUtil.isCourseSite(siteInfo.site_type) && templateSite == null) {
AcademicSession academicSession = courseManagementService.getAcademicSession(siteInfo.term);
if (Instant.now().isAfter(new Date(academicSession.getStartDate().getTime()).toInstant())
&& Instant.now().isBefore(new Date(academicSession.getEndDate().getTime()).toInstant())) {
// We are currently inside the term dates, so publish.
Expand All @@ -2802,9 +2801,7 @@ else if (state.getAttribute(STATE_CM_REQUESTED_SECTIONS) != null) {

// SAK-24423 - add joinable site settings to context
JoinableSiteSettings.addJoinableSiteSettingsToEditAccessContextWhenSiteIsNull( context, siteInfo, true );

// the template site, if using one
Site templateSite = (Site) state.getAttribute(STATE_TEMPLATE_SITE);

try {
AcademicSession academicSession = courseManagementService.getAcademicSession(siteInfo.term);
long courseStartTime = academicSession.getStartDate().getTime();
Expand Down

0 comments on commit 7bc8da7

Please sign in to comment.