Remove system.no_auto_update personal config key and assume default value of true

- By popular request, the behavior with false was too perturbating
This commit is contained in:
Hypolite Petovan 2023-01-05 10:27:03 -05:00
parent dfcfae6bcc
commit 3b9bf4d70d
7 changed files with 40 additions and 44 deletions

View file

@ -41,43 +41,45 @@ class Network extends NetworkModule
$o = '';
if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($request['force'] == 1)) {
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());
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);
}
}