From: Hypolite Petovan <mrpetovan@gmail.com>
Date: Sun, 19 Nov 2017 05:57:31 +0000 (-0500)
Subject: Add smart_threading user setting
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2336fa9d74ff395439066e9ffcf77a83fb0a35c1;p=friendica.git

Add smart_threading user setting
---

diff --git a/mod/settings.php b/mod/settings.php
index c0b3d2cc16..bc6425171c 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -303,6 +303,7 @@ function settings_post(App $a) {
 		$infinite_scroll   = x($_POST, 'infinite_scroll')   ? intval($_POST['infinite_scroll'])    : 0;
 		$no_auto_update    = x($_POST, 'no_auto_update')    ? intval($_POST['no_auto_update'])     : 0;
 		$bandwidth_saver   = x($_POST, 'bandwidth_saver')   ? intval($_POST['bandwidth_saver'])    : 0;
+		$smart_threading   = x($_POST, 'smart_threading')   ? intval($_POST['smart_threading'])    : 0;
 		$nowarn_insecure   = x($_POST, 'nowarn_insecure')   ? intval($_POST['nowarn_insecure'])    : 0;
 		$browser_update    = x($_POST, 'browser_update')    ? intval($_POST['browser_update'])     : 0;
 		if ($browser_update != -1) {
@@ -335,6 +336,7 @@ function settings_post(App $a) {
 		PConfig::set(local_user(), 'system', 'infinite_scroll'         , $infinite_scroll);
 		PConfig::set(local_user(), 'system', 'no_auto_update'          , $no_auto_update);
 		PConfig::set(local_user(), 'system', 'bandwidth_saver'         , $bandwidth_saver);
+		PConfig::set(local_user(), 'system', 'smart_threading'         , $smart_threading);
 
 		if ($theme == $a->user['theme']) {
 			// call theme_post only if theme has not been changed
@@ -989,6 +991,7 @@ function settings_content(App $a) {
 		$infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
 		$no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0);
 		$bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0);
+		$smart_threading = PConfig::get(local_user(), 'system', 'smart_threading', 0);
 
 		$theme_config = "";
 		if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
@@ -1017,6 +1020,7 @@ function settings_content(App $a) {
 			'$infinite_scroll'	=> array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''),
 			'$no_auto_update'	=> array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, t('When disabled, the network page is updated all the time, which could be confusing while reading.')),
 			'$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')),
+			'$smart_threading' => array('smart_threading', t('Smart Threading'), $smart_threading, t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')),
 
 			'$d_tset' => t('General Theme Settings'),
 			'$d_ctset' => t('Custom Theme Settings'),
diff --git a/view/templates/settings_display.tpl b/view/templates/settings_display.tpl
index ef2091035f..ff3e4fba6e 100644
--- a/view/templates/settings_display.tpl
+++ b/view/templates/settings_display.tpl
@@ -20,6 +20,7 @@
 {{include file="field_checkbox.tpl" field=$noinfo}}
 {{include file="field_checkbox.tpl" field=$infinite_scroll}}
 {{include file="field_checkbox.tpl" field=$bandwidth_saver}}
+{{include file="field_checkbox.tpl" field=$smart_threading}}
 <h2>{{$calendar_title}}</h2>
 {{include file="field_select.tpl" field=$first_day_of_week}}
 
diff --git a/view/theme/frio/templates/settings_display.tpl b/view/theme/frio/templates/settings_display.tpl
index 177fa63117..cc36762dc9 100644
--- a/view/theme/frio/templates/settings_display.tpl
+++ b/view/theme/frio/templates/settings_display.tpl
@@ -75,6 +75,7 @@
 						{{include file="field_checkbox.tpl" field=$noinfo}}
 						{{include file="field_checkbox.tpl" field=$infinite_scroll}}
 						{{include file="field_checkbox.tpl" field=$bandwidth_saver}}
+						{{include file="field_checkbox.tpl" field=$smart_threading}}
 
 						<div class="form-group pull-right settings-submit-wrapper" >
 							<button type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>