]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Item.php
Add common relationship methods to Model\ContactRelation
[friendica.git] / src / Model / Item.php
index a4ba41a69586fd66b9e78d5fc567b90531d044f4..b6f8ffa3d1665e5950aa3b69e9dbb05a868fea50 100644 (file)
@@ -2175,7 +2175,12 @@ class Item
        public static function storeForUserByUriId(int $uri_id, int $uid)
        {
                $item = self::selectFirst(self::ITEM_FIELDLIST, ['uri-id' => $uri_id, 'uid' => 0]);
-               if (empty($item) || ($item['private'] != self::PRIVATE)) {
+               if (!DBA::isResult($item)) {
+                       return 0;
+               }
+
+               if (($item['private'] == self::PRIVATE) || !in_array($item['network'], Protocol::FEDERATED)) {
+                       Logger::notice('Item is private or not from a federated network. It will not be stored for the user.', ['uri-id' => $uri_id, 'uid' => $uid, 'private' => $item['private'], 'network' => $item['network']]);
                        return 0;
                }
 
@@ -3700,8 +3705,10 @@ class Item
         */
        public static function fetchByLink(string $uri, int $uid = 0)
        {
+               Logger::info('Trying to fetch link', ['uid' => $uid, 'uri' => $uri]);
                $item_id = self::searchByLink($uri, $uid);
                if (!empty($item_id)) {
+                       Logger::info('Link found', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
                        return $item_id;
                }
 
@@ -3712,9 +3719,11 @@ class Item
                }
 
                if (!empty($item_id)) {
+                       Logger::info('Link fetched', ['uid' => $uid, 'uri' => $uri, 'id' => $item_id]);
                        return $item_id;
                }
 
+               Logger::info('Link not found', ['uid' => $uid, 'uri' => $uri]);
                return 0;
        }