2020-10-13 00:23:17 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Module\Update;
|
|
|
|
|
|
|
|
use Friendica\Core\System;
|
|
|
|
use Friendica\DI;
|
2021-01-15 23:16:09 -05:00
|
|
|
use Friendica\Model\Post;
|
2020-10-13 00:23:17 -04:00
|
|
|
use Friendica\Module\Conversation\Network as NetworkModule;
|
|
|
|
|
|
|
|
class Network extends NetworkModule
|
|
|
|
{
|
2021-11-20 09:38:03 -05:00
|
|
|
protected function rawContent(array $request = [])
|
2020-10-13 00:23:17 -04:00
|
|
|
{
|
|
|
|
if (!isset($_GET['p']) || !isset($_GET['item'])) {
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2021-11-14 17:19:25 -05:00
|
|
|
$this->parseRequest($_GET);
|
2020-10-13 00:23:17 -04:00
|
|
|
|
|
|
|
$profile_uid = intval($_GET['p']);
|
|
|
|
|
|
|
|
$o = '';
|
|
|
|
|
|
|
|
if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) {
|
|
|
|
if (!empty($_GET['item'])) {
|
2021-01-15 23:16:09 -05:00
|
|
|
$item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
|
2020-10-13 00:23:17 -04:00
|
|
|
$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'] = 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`';
|
|
|
|
} else {
|
|
|
|
$ordering = '`commented`';
|
|
|
|
}
|
|
|
|
|
2021-09-23 17:18:36 -04:00
|
|
|
$o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, local_user());
|
2020-10-13 00:23:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
System::htmlUpdateExit($o);
|
|
|
|
}
|
|
|
|
}
|