Skip to content

Commit

Permalink
feat: Drop Pages and Navigation of deleted Site - Meeds-io/MIPs#165
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Oct 29, 2024
1 parent 135a4d4 commit 4b66e2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.mop.service.LayoutService;
import org.exoplatform.portal.mop.service.NavigationService;
import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.services.resources.LocaleConfig;
import org.exoplatform.services.resources.LocaleConfigService;
Expand All @@ -55,6 +56,9 @@ public class SiteLayoutService {
@Autowired
private LayoutService layoutService;

@Autowired
private NavigationService navigationService;

@Autowired
private LocaleConfigService localeConfigService;

Expand Down Expand Up @@ -151,6 +155,8 @@ public void deleteSite(SiteKey siteKey, String username) throws IllegalAccessExc
} else if (!aclService.canEditSite(siteKey, username)) {
throw new IllegalAccessException(String.format("Site with key %s can't be deleted by user %s", siteKey, username));
}
navigationService.destroyNavigation(siteKey);
layoutService.removePages(siteKey);
layoutService.remove(portalConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.service.LayoutService;
import org.exoplatform.portal.mop.service.NavigationService;
import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.services.resources.LocaleConfig;
import org.exoplatform.services.resources.LocaleConfigService;
Expand All @@ -75,6 +76,9 @@ public class SiteLayoutServiceTest {
@MockBean
private LayoutService layoutService;

@MockBean
private NavigationService navigationService;

@MockBean
private UserPortalConfigService portalConfigService;

Expand Down

0 comments on commit 4b66e2d

Please sign in to comment.