3 namespace Friendica\Module\Update;
5 use Friendica\Core\System;
7 use Friendica\Model\Item;
8 use Friendica\Model\Post;
9 use Friendica\Module\Conversation\Network as NetworkModule;
11 class Network extends NetworkModule
13 public static function rawContent(array $parameters = [])
15 if (!isset($_GET['p']) || !isset($_GET['item'])) {
19 self::parseRequest($parameters, $_GET);
21 $profile_uid = intval($_GET['p']);
25 if (!DI::pConfig()->get($profile_uid, 'system', 'no_auto_update') || ($_GET['force'] == 1)) {
26 if (!empty($_GET['item'])) {
27 $item = Post::selectFirst(['parent'], ['id' => $_GET['item']]);
28 $parent = $item['parent'] ?? 0;
33 $conditionFields = [];
34 if (!empty($parent)) {
35 // Load only a single thread
36 $conditionFields['parent'] = $parent;
37 } elseif (self::$order === 'received') {
38 // Only load new toplevel posts
39 $conditionFields['unseen'] = true;
40 $conditionFields['gravity'] = GRAVITY_PARENT;
42 // Load all unseen items
43 $conditionFields['unseen'] = true;
46 $params = ['limit' => 100];
47 $table = 'network-item-view';
49 $items = self::getItems($table, $params, $conditionFields);
51 if (self::$order === 'received') {
52 $ordering = '`received`';
54 $ordering = '`commented`';
57 $o = conversation(DI::app(), $items, 'network', $profile_uid, false, $ordering, local_user());
60 System::htmlUpdateExit($o);