aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-12-15 20:31:06 +0100
committerMario <mario@mariovavti.com>2018-12-15 20:31:06 +0100
commitcc66e1d96607c0f57036f0ba4505a128d695730b (patch)
treeb53a20631e34111243f9ae467cc4e89cc5bebd19 /Zotlabs
parent919ea9f750fbb665a655cd26ae86c00e424a4318 (diff)
parentde7cb6d6ad7902f28e63759350613ed4b30a055b (diff)
downloadvolse-hubzilla-cc66e1d96607c0f57036f0ba4505a128d695730b.tar.gz
volse-hubzilla-cc66e1d96607c0f57036f0ba4505a128d695730b.tar.bz2
volse-hubzilla-cc66e1d96607c0f57036f0ba4505a128d695730b.zip
Merge branch 'patch-20181214d' into 'dev'
Make Affinity Slider (optionally) 'sticky' across page loads. See merge request hubzilla/core!1429
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Module/Network.php7
-rw-r--r--Zotlabs/Module/Settings/Featured.php8
-rw-r--r--Zotlabs/Widget/Affinity.php9
3 files changed, 22 insertions, 2 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index b93faa612..d5cc06d09 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -132,6 +132,13 @@ class Network extends \Zotlabs\Web\Controller {
$deftag = '';
+ if (feature_enabled(local_channel(),'affinity')) {
+ $affinity_locked = intval(get_pconfig(local_channel(),'affinity','lock',1));
+ if ($affinity_locked) {
+ set_pconfig(local_channel(),'affinity','cmin',$cmin);
+ set_pconfig(local_channel(),'affinity','cmax',$cmax);
+ }
+ }
if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category || $conv || $unseen)
$nouveau = true;
diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php
index 542a05363..1d903fcf7 100644
--- a/Zotlabs/Module/Settings/Featured.php
+++ b/Zotlabs/Module/Settings/Featured.php
@@ -17,8 +17,12 @@ class Featured {
$cmin = intval($_POST['affinity_cmin']);
if($cmin < 0 || $cmin > 99)
$cmin = 0;
+
+ $lock = ($_POST['affinity_lock']) ? intval($_POST['affinity_lock']) : 1;
+
set_pconfig(local_channel(),'affinity','cmin',$cmin);
set_pconfig(local_channel(),'affinity','cmax',$cmax);
+ set_pconfig(local_channel(),'affinity','lock',$lock);
info( t('Affinity Slider settings updated.') . EOL);
@@ -49,6 +53,10 @@ class Featured {
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
'$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, t('0-99 - default 0'))
));
+ $lock = intval(get_pconfig(local_channel(),'affinity','lock',1));
+ $setting_fields .= replace_macros(get_markup_template('field_checkbox.tpl'), array(
+ '$field' => array('affinity_lock', t('Always reset on new page visit.'), $lock, t('default: yes'), Array('No','Yes'))
+ ));
$settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array(
'$addon' => array('affinity_slider', '' . t('Affinity Slider Settings'), '', t('Submit')),
diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php
index 4fb2874ae..28190e187 100644
--- a/Zotlabs/Widget/Affinity.php
+++ b/Zotlabs/Widget/Affinity.php
@@ -15,9 +15,14 @@ class Affinity {
$cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $default_cmin);
$cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $default_cmax);
-
if(feature_enabled(local_channel(),'affinity')) {
+ $affinity_locked = intval(get_pconfig(local_channel(),'affinity','lock',1));
+ if ($affinity_locked) {
+ set_pconfig(local_channel(),'affinity','cmin',$cmin);
+ set_pconfig(local_channel(),'affinity','cmax',$cmax);
+ }
+
$labels = array(
t('Me'),
t('Family'),
@@ -53,4 +58,4 @@ class Affinity {
return '';
}
}
- \ No newline at end of file
+