]> git.mxchange.org Git - friendica.git/commitdiff
Add feedback :-)
authorPhilipp <admin@philipp.info>
Tue, 14 Sep 2021 22:31:33 +0000 (00:31 +0200)
committerPhilipp <admin@philipp.info>
Sat, 18 Sep 2021 10:51:09 +0000 (12:51 +0200)
src/Database/Database.php
src/Model/Contact.php
src/Model/Item.php
src/Module/Contact.php

index c11e04936b26f83664627fa721ad0baad0f316df..e4a4a0f571bf4bd0efb0f0c5adcb08872a658d9f 100644 (file)
@@ -1461,8 +1461,8 @@ class Database
 
                $row = $this->fetchFirst($sql, $condition);
 
-               if (empty($row['count'])) {
-                       $this->logger->notice('Invalid count.', ['table' => $table, 'expression' => $expression, 'condition' => $condition_string]);
+               if (!isset($row['count'])) {
+                       $this->logger->notice('Invalid count.', ['table' => $table, 'expression' => $expression, 'condition' => $condition_string, 'callstack' => System::callstack()]);
                        return 0;
                } else {
                        // Ensure to always return either a "null" or a numeric value
index 51d162ae22181ce07673b87da3bd4d245c4e85f8..7f72b38d61aa14484fab852a846b0f61ac5bd647 100644 (file)
@@ -2759,7 +2759,7 @@ class Contact
 
        public static function removeFollower(array $contact)
        {
-               if (!empty($contact['rel']) && (($contact['rel'] == self::FRIEND) || ($contact['rel'] == self::SHARING))) {
+               if (in_array($contact['rel'] ?? [], [self::FRIEND, self::SHARING])) {
                        DBA::update('contact', ['rel' => self::SHARING], ['id' => $contact['id']]);
                } elseif (!empty($contact['id'])) {
                        self::remove($contact['id']);
index 992c8d471077d1f0977cafc128f83691871b2228..83cbcbb01a4b97264debe7b6b1dd0a731c65341b 100644 (file)
@@ -2259,7 +2259,7 @@ class Item
                $condition[0] .= " AND `received` < UTC_TIMESTAMP() - INTERVAL ? DAY";
                $condition[] = $days;
 
-               $items = Post::select(['resource-id', 'starred', 'id', 'post-type', 'uid', 'uri-id'], $condition);
+               $items = Post::select(['resource-id', 'starred', 'id', 'post-type', 'uid', 'uri-id', 'post-type'], $condition);
 
                if (!DBA::isResult($items)) {
                        return;
@@ -2292,9 +2292,9 @@ class Item
                                continue;
                        } elseif (!$expire_starred && intval($item['starred'])) {
                                continue;
-                       } elseif (!$expire_notes && (($item['post-type'] ?? null) == self::PT_PERSONAL_NOTE)) {
+                       } elseif (!$expire_notes && ($item['post-type'] == self::PT_PERSONAL_NOTE)) {
                                continue;
-                       } elseif (!$expire_items && (($item['post-type'] ?? null) != self::PT_PERSONAL_NOTE)) {
+                       } elseif (!$expire_items && ($item['post-type'] != self::PT_PERSONAL_NOTE)) {
                                continue;
                        }
 
index 0260e90f1fb3d8b8d1528c853bc13c0c87036b26..7d323c7a3ecbb59cc8367a2a972fb75b0291359f 100644 (file)
@@ -290,11 +290,17 @@ class Contact extends BaseModule
                                $contact_id = $data['user'];
                        }
 
-                       $contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'deleted' => false]);
-
-                       // Don't display contacts that are about to be deleted
-                       if (DBA::isResult($contact) && !empty($contact['network']) && $contact['network'] == Protocol::PHANTOM) {
-                               $contact = false;
+                       if (empty($data)) {
+                               $contact = DBA::selectFirst('contact', [], [
+                                       'id'      => $contact_id,
+                                       'uid'     => [0, local_user()],
+                                       'deleted' => false
+                               ]);
+
+                               // Don't display contacts that are about to be deleted
+                               if (DBA::isResult($contact) && !empty($contact['network']) && $contact['network'] == Protocol::PHANTOM) {
+                                       $contact = false;
+                               }
                        }
                }