Skip to content

Commit

Permalink
fixed query filter for questions with no accepted answer, when applie…
Browse files Browse the repository at this point in the history
…d through the filter drawer
  • Loading branch information
albogdano committed Sep 16, 2024
1 parent e694730 commit d615249
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ public String applyFilter(@RequestParam(required = false) String sortby,
if (!StringUtils.isBlank(typeFilter)) {
HttpUtils.setRawCookie("questions-type-filter", typeFilter,
req, res, "Strict", (int) TimeUnit.DAYS.toSeconds(365));
} else {
HttpUtils.removeStateParam("questions-type-filter", req, res);
}
savePagerToCookie(req, res, p);
HttpUtils.setRawCookie("questions-view-compact", compactViewEnabled,
Expand Down Expand Up @@ -451,7 +453,7 @@ private String getQueryWithPossibleExtension(String query, HttpServletRequest re
queryExt = StringUtils.trimToEmpty(HttpUtils.getCookieValue(req, "questions-type-filter"));
}
if (!queryExt.isBlank()) {
return query.equals("*") ? queryExt : query + " AND (" + queryExt + ")";
return query.equals("*") ? queryExt : query + " AND (" + Utils.urlDecode(queryExt) + ")";

This comment has been minimized.

Copy link
@WouterEverse

WouterEverse Sep 16, 2024

@albogdano This urlDecoding should be done in both cases, not only in the latter case. So replace by:

queryExt = Utils.urlDecode(queryExt); return query.equals("*") ? queryExt : query + " AND (" + queryExt + ")";

This comment has been minimized.

Copy link
@albogdano

albogdano Sep 16, 2024

Author Member

Absolutely - I rushed the commit and missed the first variable. Thanks!

}
return query;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/questions.vm
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
#macro(filterselected $prop)
#if($questionsTypeFilter == $prop)selected#end
#end
#set($unacceptedQuery = "properties.answercount:[1 TO *] NOT properties.answerid:[* TO *]" )
#set($unacceptedQuery = $utils.urlEncode("properties.answercount:[1 TO *] NOT properties.answerid:[* TO *]") )
<select name="typeFilter">
<option value="" #filterselected("")>$!lang.get('showall')</option>
<option value="type:question" #filterselected("type:question")>$!lang.get('questions.title')</option>
Expand Down

0 comments on commit d615249

Please sign in to comment.