Skip to content

Node.js based forum software built for the modern web

if no sorting specificed let search plugins handle

barisusakli5d5b74f3edcb
diff --git a/src/search.js b/src/search.js
index 9b7306c7fa..b34704bf47 100644
--- a/src/search.js
+++ b/src/search.js
@@ -298,10 +298,10 @@ function filterByTimerange(posts, timeRange, timeFilter) {
}
function sortPosts(posts, data) {
- if (!posts.length) {
+ if (!posts.length || !data.sortBy) {
return;
}
- data.sortBy = data.sortBy || 'timestamp';
+
data.sortDirection = data.sortDirection || 'desc';
var direction = data.sortDirection === 'desc' ? 1 : -1;