File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
src/main/java/ru/mystamps/web/feature/series Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 72
72
import java .util .Locale ;
73
73
import java .util .Map ;
74
74
import java .util .Objects ;
75
+ import java .util .stream .Collectors ;
75
76
76
77
import static ru .mystamps .web .common .ControllerUtils .redirectTo ;
77
78
@@ -470,6 +471,8 @@ public String processAskForm(
470
471
public String searchSeriesByCatalog (
471
472
@ RequestParam (name = "catalogNumber" , defaultValue = "" ) String catalogNumber ,
472
473
@ RequestParam (name = "catalogName" , defaultValue = "" ) String catalogName ,
474
+ @ RequestParam (name = "inCollection" , defaultValue = "false" ) Boolean inCollection ,
475
+ @ CurrentUser Integer currentUserId ,
473
476
Model model ,
474
477
Locale userLocale ,
475
478
RedirectAttributes redirectAttributes ) {
@@ -504,6 +507,18 @@ public String searchSeriesByCatalog(
504
507
series = Collections .emptyList ();
505
508
break ;
506
509
}
510
+
511
+ if (Features .SEARCH_IN_COLLECTION .isActive ()
512
+ && inCollection
513
+ && currentUserId != null ) {
514
+ series = series
515
+ .stream ()
516
+ .filter (
517
+ e -> collectionService .isSeriesInCollection (currentUserId , e .getId ())
518
+ )
519
+ .collect (Collectors .toList ());
520
+ }
521
+
507
522
model .addAttribute ("searchResults" , series );
508
523
509
524
return "series/search_result" ;
You can’t perform that action at this time.
0 commit comments