]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
Get rid of the "item" table, enhanced "post" tables
[friendica.git] / src / Model / Contact.php
index b922265e24d7490fec71f6b0667316dd68943ba0..5a3f0aaefb89c45f818422777985108f834df94e 100644 (file)
@@ -34,7 +34,6 @@ use Friendica\Core\Worker;
 use Friendica\Database\Database;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Model\Notify\Type;
 use Friendica\Network\HTTPException;
 use Friendica\Network\Probe;
 use Friendica\Protocol\Activity;
@@ -1296,9 +1295,9 @@ class Contact
                }
 
                if (empty($contact["network"]) || in_array($contact["network"], Protocol::FEDERATED)) {
-                       $sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))";
+                       $sql = "(`uid` = 0 OR (`uid` = ? AND NOT `global`))";
                } else {
-                       $sql = "`item`.`uid` = ?";
+                       $sql = "`uid` = ?";
                }
 
                $contact_field = ((($contact["contact-type"] == self::TYPE_COMMUNITY) || ($contact['network'] == Protocol::MAIL)) ? 'owner-id' : 'author-id');
@@ -1340,18 +1339,11 @@ class Contact
                }
 
                if ($thread_mode) {             
-                       $r = Item::selectForUser(local_user(), ['uri', 'gravity', 'parent-uri', 'thr-parent-id', 'author-id'], $condition, $params);
-                       $items = [];
-                       while ($item = DBA::fetch($r)) {
-                               $items[] = $item;
-                       }
-                       DBA::close($r);
+                       $items = Post::toArray(Post::selectForUser(local_user(), ['uri-id', 'gravity', 'parent-uri-id', 'thr-parent-id', 'author-id'], $condition, $params));
 
                        $o .= conversation($a, $items, 'contacts', $update, false, 'commented', local_user());
                } else {
-                       $r = Item::selectForUser(local_user(), [], $condition, $params);
-
-                       $items = Item::inArray($r);
+                       $items = Post::toArray(Post::selectForUser(local_user(), Item::DISPLAY_FIELDLIST, $condition, $params));
 
                        $o .= conversation($a, $items, 'contact-posts', $update);
                }
@@ -2506,12 +2498,12 @@ class Contact
 
                                Group::addMember(User::getDefaultGroup($importer['uid'], $contact_record["network"]), $contact_record['id']);
 
-                               if (($user['notify-flags'] & Type::INTRO) &&
+                               if (($user['notify-flags'] & Notification\Type::INTRO) &&
                                        in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL])) {
 
                                        notification([
-                                               'type'  => Type::INTRO,
-                                               'otype' => Notify\ObjectType::INTRO,
+                                               'type'  => Notification\Type::INTRO,
+                                               'otype' => Notification\ObjectType::INTRO,
                                                'verb'  => ($sharing ? Activity::FRIEND : Activity::FOLLOW),
                                                'uid'   => $user['uid'],
                                                'cid'   => $contact_record['id'],