]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Update/Profile.php
Merge pull request #9939 from jurassic-c/mimetype-dotname-fix
[friendica.git] / src / Module / Update / Profile.php
index 56e86feb361ee3871fc0f17632fbba66a172f964..bab1a63a344b08a1b30f7027605f9643bf4239b1 100644 (file)
@@ -68,30 +68,24 @@ class Profile extends BaseModule
 
                $last_updated = $last_updated_array[$last_updated_key] ?? 0;
 
-               // 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.
-               if ($is_owner || !$last_updated) {
-                       $sql_extra4 = " AND `item`.`unseen`";
+               if ($_GET['force'] && !empty($_GET['item'])) {
+                       // When the parent is provided, we only fetch this
+                       $sql_extra4 = " AND `parent` = " . intval($_GET['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.
+                       $sql_extra4 = " AND `unseen`";
                } else {
                        $gmupdate = gmdate(DateTimeFormat::MYSQL, $last_updated);
-                       $sql_extra4 = " AND `item`.`received` > '" . $gmupdate . "'";
+                       $sql_extra4 = " AND `received` > '" . $gmupdate . "'";
                }
 
                $items_stmt = DBA::p(
-                       "SELECT DISTINCT(`parent-uri`) AS `uri`, `item`.`created`
-                       FROM `item`
-                       INNER JOIN `contact`
-                       ON `contact`.`id` = `item`.`contact-id`
-                               AND NOT `contact`.`blocked`
-                               AND NOT `contact`.`pending`
-                       WHERE `item`.`uid` = ?
-                               AND `item`.`visible`
-                               AND     (NOT `item`.`deleted` OR `item`.`gravity` = ?)
-                               AND NOT `item`.`moderated`
-                               AND `item`.`wall`
-                               $sql_extra4
-                               $sql_extra
-                       ORDER BY `item`.`received` DESC",
+                       "SELECT DISTINCT(`parent-uri-id`) AS `uri-id`, `created` FROM `post-view`
+                               WHERE `uid` = ? AND NOT `contact-blocked` AND NOT `contact-pending`
+                               AND `visible` AND (NOT `deleted` OR `gravity` = ?)
+                               AND `wall` $sql_extra4 $sql_extra
+                       ORDER BY `received` DESC",
                        $a->profile['uid'],
                        GRAVITY_ACTIVITY
                );