Skip to content

Commit

Permalink
fixed search filter for answered questions
Browse files Browse the repository at this point in the history
  • Loading branch information
albogdano committed Mar 28, 2022
1 parent 15bc793 commit 1fa5193
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ private String getQuestionsQuery(HttpServletRequest req, Profile authUser, Strin
p.setSortby("properties.lastactivity");
} else if ("votes".equals(sortby)) {
p.setSortby("votes");
} else if ("answered".equals(sortby)) {
p.setSortby("timestamp");
String q = "properties.answerid:[* TO *]";
query = utils.getSpaceFilteredQuery(req, spaceFiltered,
utils.getSpaceFilter(authUser, currentSpace) + " AND " + q, q);
} else if ("unanswered".equals(sortby)) {
p.setSortby("timestamp");
if ("default_pager".equals(p.getName()) && p.isDesc()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/macro.vm
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
#macro(tagsbox $post $link)
#set($tags = $post.tags)
#if($post.answerid)
<a href="$questionslink?sortby=properties.answerid" title="Posts with approved answer" class="chip mrs light-green white-text">
<a href="$questionslink?sortby=answered" title="Posts with approved answer" class="chip mrs light-green white-text">
<i class="fa fa-check-circle"></i> $!lang.get('posts.answered')
</a>
#end
Expand Down

0 comments on commit 1fa5193

Please sign in to comment.