3 namespace Friendica\Module\Update;
5 use Friendica\Core\System;
7 use Friendica\Model\Post;
8 use Friendica\Module\Conversation\Network as NetworkModule;
10 class Network extends NetworkModule
12 public static function rawContent()
14 if (!isset($_GET['p']) || !isset($_GET['item'])) {
18 self::parseRequest($_GET);
20 $profile_uid = intval($_GET['p']);
24 if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) {
25 if (!empty($_GET['item'])) {
26 $item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
27 $parent = $item['parent'] ?? 0;
32 $conditionFields = [];
33 if (!empty($parent)) {
34 // Load only a single thread
35 $conditionFields['parent'] = $parent;
36 } elseif (self::$order === 'received') {
37 // Only load new toplevel posts
38 $conditionFields['unseen'] = true;
39 $conditionFields['gravity'] = GRAVITY_PARENT;
41 // Load all unseen items
42 $conditionFields['unseen'] = true;
45 $params = ['limit' => 100];
46 $table = 'network-item-view';
48 $items = self::getItems($table, $params, $conditionFields);
50 if (self::$order === 'received') {
51 $ordering = '`received`';
53 $ordering = '`commented`';
56 $o = DI::conversation()->create($items, 'network', $profile_uid, false, $ordering, local_user());
59 System::htmlUpdateExit($o);