]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that there will always be an author-id and owner-id in the items
authorMichael <heluecht@pirati.ca>
Tue, 8 May 2018 20:20:15 +0000 (20:20 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 8 May 2018 20:20:15 +0000 (20:20 +0000)
src/Model/Item.php

index c50e669adf048928c265caa6f4bb2b1bf627bb25..44275ae44c3ac24b20be43e04e17b6a1b3da6609 100644 (file)
@@ -488,14 +488,20 @@ class Item extends BaseObject
                // The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
                $item["contact-id"] = self::contactId($item);
 
-               $item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"]));
+               $default = ['url' => $item['author-link'], 'name' => $item['author-name'],
+                       'avatar' => $item['author-avatar'], 'network' => $item['network']];
+
+               $item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"], 0, false, $default));
 
                if (Contact::isBlocked($item["author-id"])) {
                        logger('Contact '.$item["author-id"].' is blocked, item '.$item["uri"].' will not be stored');
                        return 0;
                }
 
-               $item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"]));
+               $default = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
+                       'avatar' => $item['owner-avatar'], 'network' => $item['network']];
+
+               $item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"], 0, false, $default));
 
                if (Contact::isBlocked($item["owner-id"])) {
                        logger('Contact '.$item["owner-id"].' is blocked, item '.$item["uri"].' will not be stored');