From 398eaeb4198a14e01be42d18571489d9b9449245 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 25 Mar 2013 16:30:45 +0400 Subject: [PATCH] experimentally tweak adaptive mode to show unread articles first and other stuff later --- include/functions.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/include/functions.php b/include/functions.php index 9a3ea4315..4a584f969 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2236,13 +2236,21 @@ if ($search) { $view_query_part = " "; } else if ($feed != -1) { - $unread = getFeedUnread($link, $feed, $cat_view); - if ($cat_view && $feed > 0 && $include_children) - $unread += getCategoryChildrenUnread($link, $feed); + if (get_pref($link, "SORT_HEADLINES_BY_FEED_DATE", $owner_uid)) { + $a_date_sort_field = "updated"; + } else { + $a_date_sort_field = "date_entered"; + } - if ($unread > 0) { - $view_query_part = " unread = true AND "; + if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) { + $a_order_by = "$a_date_sort_field"; + } else { + $a_order_by = "$a_date_sort_field DESC"; + } + + if (!$override_order) { + $override_order = "unread DESC, $a_order_by"; } } }