Merge pull request #12619 from MrPetovan/task/12617-remove-no_auto_update
Remove system.no_auto_update personal config key and assume default value of true
This commit is contained in:
commit
abd3b2180f
|
@ -30,7 +30,7 @@ use Friendica\Model\Contact;
|
|||
|
||||
function update_contact_content(App $a)
|
||||
{
|
||||
if (!empty(DI::args()->get(1)) && (!empty($_GET['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update'))) {
|
||||
if (!empty(DI::args()->get(1)) && !empty($_GET['force'])) {
|
||||
$contact = Contact::getById(DI::args()->get(1), ['id', 'deleted']);
|
||||
if (DBA::isResult($contact) && empty($contact['deleted'])) {
|
||||
DI::page()['aside'] = '';
|
||||
|
|
|
@ -79,7 +79,6 @@ class Display extends BaseSettings
|
|||
$first_day_of_week = !empty($request['first_day_of_week']) ? intval($request['first_day_of_week']) : 0;
|
||||
$calendar_default_view = !empty($request['calendar_default_view']) ? trim($request['calendar_default_view']) : 'month';
|
||||
$infinite_scroll = !empty($request['infinite_scroll']) ? intval($request['infinite_scroll']) : 0;
|
||||
$no_auto_update = !empty($request['no_auto_update']) ? intval($request['no_auto_update']) : 0;
|
||||
$enable_smart_threading = !empty($request['enable_smart_threading']) ? intval($request['enable_smart_threading']) : 0;
|
||||
$enable_dislike = !empty($request['enable_dislike']) ? intval($request['enable_dislike']) : 0;
|
||||
$display_resharer = !empty($request['display_resharer']) ? intval($request['display_resharer']) : 0;
|
||||
|
@ -113,7 +112,6 @@ class Display extends BaseSettings
|
|||
$this->pConfig->set($uid, 'system', 'itemspage_network' , $itemspage_network);
|
||||
$this->pConfig->set($uid, 'system', 'itemspage_mobile_network', $itemspage_mobile_network);
|
||||
$this->pConfig->set($uid, 'system', 'update_interval' , $browser_update);
|
||||
$this->pConfig->set($uid, 'system', 'no_auto_update' , $no_auto_update);
|
||||
$this->pConfig->set($uid, 'system', 'no_smilies' , !$enable_smile);
|
||||
$this->pConfig->set($uid, 'system', 'infinite_scroll' , $infinite_scroll);
|
||||
$this->pConfig->set($uid, 'system', 'no_smart_threading' , !$enable_smart_threading);
|
||||
|
@ -202,7 +200,6 @@ class Display extends BaseSettings
|
|||
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
|
||||
}
|
||||
|
||||
$no_auto_update = $this->pConfig->get($uid, 'system', 'no_auto_update', 0);
|
||||
$enable_smile = !$this->pConfig->get($uid, 'system', 'no_smilies', 0);
|
||||
$infinite_scroll = $this->pConfig->get($uid, 'system', 'infinite_scroll', 0);
|
||||
$enable_smart_threading = !$this->pConfig->get($uid, 'system', 'no_smart_threading', 0);
|
||||
|
@ -265,7 +262,6 @@ class Display extends BaseSettings
|
|||
'$itemspage_network' => ['itemspage_network' , $this->t('Number of items to display per page:'), $itemspage_network, $this->t('Maximum of 100 items')],
|
||||
'$itemspage_mobile_network' => ['itemspage_mobile_network', $this->t('Number of items to display per page when viewed from mobile device:'), $itemspage_mobile_network, $this->t('Maximum of 100 items')],
|
||||
'$ajaxint' => ['browser_update' , $this->t('Update browser every xx seconds'), $browser_update, $this->t('Minimum of 10 seconds. Enter -1 to disable it.')],
|
||||
'$no_auto_update' => ['no_auto_update' , $this->t('Automatic updates only at the top of the post stream pages'), $no_auto_update, $this->t('Auto update may add new posts at the top of the post stream pages, which can affect the scroll position and perturb normal reading if it happens anywhere else the top of the page.')],
|
||||
'$enable_smile' => ['enable_smile' , $this->t('Display emoticons'), $enable_smile, $this->t('When enabled, emoticons are replaced with matching symbols.')],
|
||||
'$infinite_scroll' => ['infinite_scroll' , $this->t('Infinite scroll'), $infinite_scroll, $this->t('Automatic fetch new items when reaching the page end.')],
|
||||
'$enable_smart_threading' => ['enable_smart_threading' , $this->t('Enable Smart Threading'), $enable_smart_threading, $this->t('Enable the automatic suppression of extraneous thread indentation.')],
|
||||
|
|
|
@ -38,7 +38,7 @@ class Community extends CommunityModule
|
|||
$this->parseRequest();
|
||||
|
||||
$o = '';
|
||||
if (!empty($_GET['force']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) {
|
||||
if (!empty($request['force'])) {
|
||||
$o = DI::conversation()->create(self::getItems(), 'community', true, false, 'commented', DI::userSession()->getLocalUserId());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,53 +31,55 @@ class Network extends NetworkModule
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
if (!isset($_GET['p']) || !isset($_GET['item'])) {
|
||||
if (!isset($request['p']) || !isset($request['item'])) {
|
||||
System::exit();
|
||||
}
|
||||
|
||||
$this->parseRequest($_GET);
|
||||
$this->parseRequest($request);
|
||||
|
||||
$profile_uid = intval($_GET['p']);
|
||||
$profile_uid = intval($request['p']);
|
||||
|
||||
$o = '';
|
||||
|
||||
if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) {
|
||||
if (!empty($_GET['item'])) {
|
||||
$item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
|
||||
$parent = $item['parent'] ?? 0;
|
||||
} else {
|
||||
$parent = 0;
|
||||
}
|
||||
|
||||
$conditionFields = [];
|
||||
if (!empty($parent)) {
|
||||
// Load only a single thread
|
||||
$conditionFields['parent'] = $parent;
|
||||
} elseif (self::$order === 'received') {
|
||||
// Only load new toplevel posts
|
||||
$conditionFields['unseen'] = true;
|
||||
$conditionFields['gravity'] = Item::GRAVITY_PARENT;
|
||||
} else {
|
||||
// Load all unseen items
|
||||
$conditionFields['unseen'] = true;
|
||||
}
|
||||
|
||||
$params = ['limit' => 100];
|
||||
$table = 'network-item-view';
|
||||
|
||||
$items = self::getItems($table, $params, $conditionFields);
|
||||
|
||||
if (self::$order === 'received') {
|
||||
$ordering = '`received`';
|
||||
} elseif (self::$order === 'created') {
|
||||
$ordering = '`created`';
|
||||
} else {
|
||||
$ordering = '`commented`';
|
||||
}
|
||||
|
||||
$o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, DI::userSession()->getLocalUserId());
|
||||
if (empty($request['force'])) {
|
||||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
||||
if (!empty($request['item'])) {
|
||||
$item = Post::selectFirst(['parent'], ['id' => $request['item']]);
|
||||
$parent = $item['parent'] ?? 0;
|
||||
} else {
|
||||
$parent = 0;
|
||||
}
|
||||
|
||||
$conditionFields = [];
|
||||
if (!empty($parent)) {
|
||||
// Load only a single thread
|
||||
$conditionFields['parent'] = $parent;
|
||||
} elseif (self::$order === 'received') {
|
||||
// Only load new toplevel posts
|
||||
$conditionFields['unseen'] = true;
|
||||
$conditionFields['gravity'] = Item::GRAVITY_PARENT;
|
||||
} else {
|
||||
// Load all unseen items
|
||||
$conditionFields['unseen'] = true;
|
||||
}
|
||||
|
||||
$params = ['limit' => 100];
|
||||
$table = 'network-item-view';
|
||||
|
||||
$items = self::getItems($table, $params, $conditionFields);
|
||||
|
||||
if (self::$order === 'received') {
|
||||
$ordering = '`received`';
|
||||
} elseif (self::$order === 'created') {
|
||||
$ordering = '`created`';
|
||||
} else {
|
||||
$ordering = '`commented`';
|
||||
}
|
||||
|
||||
$o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, DI::userSession()->getLocalUserId());
|
||||
|
||||
System::htmlUpdateExit($o);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class Profile extends BaseModule
|
|||
$a = DI::app();
|
||||
|
||||
// Ensure we've got a profile owner if updating.
|
||||
$a->setProfileOwner((int)($_GET['p'] ?? 0));
|
||||
$a->setProfileOwner((int)($request['p'] ?? 0));
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !DI::userSession()->getLocalUserId() && !DI::userSession()->getRemoteContactID($a->getProfileOwner())) {
|
||||
throw new ForbiddenException();
|
||||
|
@ -58,7 +58,7 @@ class Profile extends BaseModule
|
|||
|
||||
$o = '';
|
||||
|
||||
if (empty($_GET['force']) && DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'no_auto_update')) {
|
||||
if (empty($request['force'])) {
|
||||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ class Profile extends BaseModule
|
|||
AND `visible` AND (NOT `deleted` OR `gravity` = ?)
|
||||
AND `wall` " . $sql_extra, $a->getProfileOwner(), Item::GRAVITY_ACTIVITY];
|
||||
|
||||
if ($_GET['force'] && !empty($_GET['item'])) {
|
||||
if ($request['force'] && !empty($request['item'])) {
|
||||
// When the parent is provided, we only fetch this
|
||||
$condition = DBA::mergeConditions($condition, ['parent' => $_GET['item']]);
|
||||
$condition = DBA::mergeConditions($condition, ['parent' => $request['item']]);
|
||||
} elseif ($is_owner || !$last_updated) {
|
||||
// If the page user is the owner of the page we should query for unseen
|
||||
// items. Otherwise use a timestamp of the last succesful update request.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -13,7 +13,6 @@
|
|||
|
||||
{{include file="field_input.tpl" field=$itemspage_mobile_network}}
|
||||
{{include file="field_input.tpl" field=$ajaxint}}
|
||||
{{include file="field_checkbox.tpl" field=$no_auto_update}}
|
||||
{{include file="field_checkbox.tpl" field=$enable_smile}}
|
||||
{{include file="field_checkbox.tpl" field=$infinite_scroll}}
|
||||
{{include file="field_checkbox.tpl" field=$enable_smart_threading}}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
{{include file="field_input.tpl" field=$itemspage_network}}
|
||||
{{include file="field_input.tpl" field=$itemspage_mobile_network}}
|
||||
{{include file="field_input.tpl" field=$ajaxint}}
|
||||
{{include file="field_checkbox.tpl" field=$no_auto_update}}
|
||||
{{include file="field_checkbox.tpl" field=$enable_smile}}
|
||||
{{include file="field_checkbox.tpl" field=$infinite_scroll}}
|
||||
{{include file="field_checkbox.tpl" field=$enable_smart_threading}}
|
||||
|
|
Loading…
Reference in a new issue