Skip to content

Commit

Permalink
Feature #12629
Browse files Browse the repository at this point in the history
  • Loading branch information
svuillet committed Oct 8, 2021
1 parent 039458c commit 18a9205
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ home.search.extrafield.space = false
home.publications.nb = 3
home.publications.spaceid =
home.publications.components.excluded =
home.publications.spaces.excluded =

# Turn this to false to display first main space as homepage only if regular user has access to no news
home.displayedWhenNoNews = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.silverpeas.looks.aurora;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.silverpeas.components.almanach.AlmanachSettings;
import org.silverpeas.components.delegatednews.model.DelegatedNews;
Expand All @@ -21,6 +22,8 @@
import org.silverpeas.core.admin.component.model.PersonalComponentInstance;
import org.silverpeas.core.admin.component.model.SilverpeasComponentInstance;
import org.silverpeas.core.admin.domain.model.Domain;
import org.silverpeas.core.admin.service.AdminException;
import org.silverpeas.core.admin.service.Administration;
import org.silverpeas.core.admin.service.OrganizationController;
import org.silverpeas.core.admin.space.SpaceInstLight;
import org.silverpeas.core.admin.user.model.Group;
Expand Down Expand Up @@ -285,6 +288,17 @@ public List<ComponentInst> getApplications() {
public List<PublicationDetail> getLatestPublications(String spaceId, int nbPublis) {
String[] excludedComponentIds =
StringUtils.split(getSettings("home.publications.components.excluded", ""));
String[] excludedSpaceIds =
StringUtils.split(getSettings("home.publications.spaces.excluded", ""));
for (String excludedSpaceId : excludedSpaceIds) {
try {
String [] excludedAppId = Administration.get().getAllComponentIdsRecur(excludedSpaceId);
excludedComponentIds = ArrayUtils.addAll(excludedComponentIds, excludedAppId);
} catch (AdminException e) {
SilverLogger.getLogger(this).error(e);
}
}

List<PublicationDetail> publications =
super.getLatestPublications(spaceId, Arrays.asList(excludedComponentIds), nbPublis * 2);
List<PublicationDetail> result = new ArrayList<>();
Expand Down

0 comments on commit 18a9205

Please sign in to comment.