add an option to disable DISTINCT on headlines query (unless it's Labels category)

This commit is contained in:
Andrew Dolgov 2021-02-26 09:57:34 +03:00
parent 51142e1bf8
commit f3d4bae32e
3 changed files with 10 additions and 1 deletions

View File

@ -1621,6 +1621,11 @@ class Feeds extends Handler_Protected {
$distinct_qpart = "DISTINCT"; //fallback $distinct_qpart = "DISTINCT"; //fallback
} }
// except for Labels category
if (get_pref(Prefs::HEADLINES_NO_DISTINCT) && !($feed == -2 && $cat_view)) {
$distinct_qpart = "";
}
if (!$search && !$skip_first_id_check) { if (!$search && !$skip_first_id_check) {
// if previous topmost article id changed that means our current pagination is no longer valid // if previous topmost article id changed that means our current pagination is no longer valid
$query = "SELECT $query = "SELECT

View File

@ -63,6 +63,7 @@ class Pref_Prefs extends Handler_Protected {
Prefs::SHORT_DATE_FORMAT, Prefs::SHORT_DATE_FORMAT,
'BLOCK_SEPARATOR', 'BLOCK_SEPARATOR',
Prefs::SSL_CERT_SERIAL, Prefs::SSL_CERT_SERIAL,
Prefs::HEADLINES_NO_DISTINCT,
] ]
]; ];
@ -97,7 +98,8 @@ class Pref_Prefs extends Handler_Protected {
Prefs::USER_TIMEZONE => array(__("Time zone")), Prefs::USER_TIMEZONE => array(__("Time zone")),
Prefs::VFEED_GROUP_BY_FEED => array(__("Group by feed"), __("Group multiple-feed output by originating feed")), Prefs::VFEED_GROUP_BY_FEED => array(__("Group by feed"), __("Group multiple-feed output by originating feed")),
Prefs::USER_LANGUAGE => array(__("Language")), Prefs::USER_LANGUAGE => array(__("Language")),
Prefs::USER_CSS_THEME => array(__("Theme")) Prefs::USER_CSS_THEME => array(__("Theme")),
Prefs::HEADLINES_NO_DISTINCT => array(__("Don't enforce DISTINCT headlines"), __("May produce duplicate entries")),
]; ];
// hidden in the main prefs UI (use to hide things that have description set above) // hidden in the main prefs UI (use to hide things that have description set above)

View File

@ -56,6 +56,7 @@ class Prefs {
const USER_LANGUAGE = "USER_LANGUAGE"; const USER_LANGUAGE = "USER_LANGUAGE";
const DEFAULT_SEARCH_LANGUAGE = "DEFAULT_SEARCH_LANGUAGE"; const DEFAULT_SEARCH_LANGUAGE = "DEFAULT_SEARCH_LANGUAGE";
const _PREFS_MIGRATED = "_PREFS_MIGRATED"; const _PREFS_MIGRATED = "_PREFS_MIGRATED";
const HEADLINES_NO_DISTINCT = "HEADLINES_NO_DISTINCT";
private const _DEFAULTS = [ private const _DEFAULTS = [
Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ], Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ],
@ -112,6 +113,7 @@ class Prefs {
Prefs::USER_LANGUAGE => [ "" , Config::T_STRING ], Prefs::USER_LANGUAGE => [ "" , Config::T_STRING ],
Prefs::DEFAULT_SEARCH_LANGUAGE => [ "" , Config::T_STRING ], Prefs::DEFAULT_SEARCH_LANGUAGE => [ "" , Config::T_STRING ],
Prefs::_PREFS_MIGRATED => [ false, Config::T_BOOL ], Prefs::_PREFS_MIGRATED => [ false, Config::T_BOOL ],
Prefs::HEADLINES_NO_DISTINCT => [ false, Config::T_BOOL ],
]; ];
const _PROFILE_BLACKLIST = [ const _PROFILE_BLACKLIST = [