Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-139057 Partially revert LPS-137143 #2322

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -26,7 +26,6 @@
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.taglib.util.IncludeTag;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -94,49 +93,35 @@ private Group _getGroup(ThemeDisplay themeDisplay) {
}

private List<Group> _getGroups(HttpServletRequest httpServletRequest) {
String groupType = _getGroupType(httpServletRequest);

Optional<GroupItemSelectorProvider> groupItemSelectorProviderOptional =
GroupItemSelectorTrackerUtil.getGroupItemSelectorProviderOptional(
groupType);
_getGroupType(httpServletRequest));

ThemeDisplay themeDisplay =
(ThemeDisplay)httpServletRequest.getAttribute(
WebKeys.THEME_DISPLAY);

Group group = _getGroup(themeDisplay);

String scopeGroupType = ParamUtil.getString(
httpServletRequest, "scopeGroupType");

if (Validator.isNotNull(scopeGroupType) && groupType.equals("site")) {
_groups = new ArrayList<>();

_groups.add(group);
}
else {
String keywords = ParamUtil.getString(
httpServletRequest, "keywords");

int cur = ParamUtil.getInteger(
httpServletRequest, SearchContainer.DEFAULT_CUR_PARAM,
SearchContainer.DEFAULT_CUR);
int delta = ParamUtil.getInteger(
httpServletRequest, SearchContainer.DEFAULT_DELTA_PARAM,
SearchContainer.DEFAULT_DELTA);

int[] startAndEnd = SearchPaginationUtil.calculateStartAndEnd(
cur, delta);

_groups = groupItemSelectorProviderOptional.map(
groupItemSelectorProvider ->
groupItemSelectorProvider.getGroups(
group.getCompanyId(), group.getGroupId(), keywords,
startAndEnd[0], startAndEnd[1])
).orElse(
Collections.emptyList()
);
}
String keywords = ParamUtil.getString(httpServletRequest, "keywords");

int cur = ParamUtil.getInteger(
httpServletRequest, SearchContainer.DEFAULT_CUR_PARAM,
SearchContainer.DEFAULT_CUR);
int delta = ParamUtil.getInteger(
httpServletRequest, SearchContainer.DEFAULT_DELTA_PARAM,
SearchContainer.DEFAULT_DELTA);

int[] startAndEnd = SearchPaginationUtil.calculateStartAndEnd(
cur, delta);

_groups = groupItemSelectorProviderOptional.map(
groupItemSelectorProvider -> groupItemSelectorProvider.getGroups(
group.getCompanyId(), group.getGroupId(), keywords,
startAndEnd[0], startAndEnd[1])
).orElse(
Collections.emptyList()
);

return _groups;
}
Expand Down