File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
quickinfo/quickinfo-library/src/main/java/org/silverpeas/components/quickinfo/model Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 69
69
import javax .transaction .Transactional ;
70
70
import java .sql .Connection ;
71
71
import java .sql .SQLException ;
72
+ import java .util .Arrays ;
72
73
import java .util .Collection ;
73
74
import java .util .Date ;
74
75
import java .util .HashMap ;
83
84
84
85
import static java .util .Arrays .asList ;
85
86
import static java .util .Collections .singletonList ;
87
+ import static java .util .function .Predicate .not ;
86
88
import static org .silverpeas .components .quickinfo .notification .QuickInfoDelayedVisibilityUserNotificationReminder .QUICKINFO_DELAYED_VISIBILITY_USER_NOTIFICATION ;
87
89
import static org .silverpeas .core .pdc .pdc .model .PdcClassification .aPdcClassificationOfContent ;
88
90
@@ -310,8 +312,12 @@ public List<News> getPlatformNews(String userId) {
310
312
.getComponentIdsForUser (userId , QuickInfoComponentSettings .COMPONENT_NAME );
311
313
int limit = QuickInfoComponentSettings .getSettings ().getInteger ("news.all.limit" , 30 );
312
314
//noinspection SimplifyStreamApiCallChains
313
- return newsRepository .getByComponentIds (asList (allowedComponentIds ))
315
+ return Optional .ofNullable (allowedComponentIds )
316
+ .map (Arrays ::asList )
317
+ .filter (not (List ::isEmpty ))
318
+ .map (newsRepository ::getByComponentIds )
314
319
.stream ()
320
+ .flatMap (List ::stream )
315
321
.filter (n -> n .getPublishDate () != null )
316
322
.map (n -> {
317
323
decorateNews (singletonList (n ), false );
You can’t perform that action at this time.
0 commit comments