]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Delivery.php
We only need to fetch the content once
[friendica.git] / src / Worker / Delivery.php
index 3ae0be140dcdc15a1c68d48fd186e9f497e40b8f..c6d24657e5aad2fe6c54f17434c5429b41d5f22d 100644 (file)
@@ -19,8 +19,7 @@ use Friendica\Protocol\DFRN;
 use Friendica\Protocol\Diaspora;
 use Friendica\Protocol\Email;
 use Friendica\Util\Strings;
-
-require_once 'include/items.php';
+use Friendica\Util\Network;
 
 class Delivery extends BaseObject
 {
@@ -89,7 +88,14 @@ class Delivery extends BaseObject
                                return;
                        }
 
-                       $uid = $target_item['contact-uid'];
+                       if (!empty($target_item['contact-uid'])) {
+                               $uid = $target_item['contact-uid'];
+                       } elseif (!empty($target_item['uid'])) {
+                               $uid = $target_item['uid'];
+                       } else {
+                               Logger::log('Only public users for item ' . $item_id, Logger::DEBUG);
+                               return;
+                       }
 
                        // avoid race condition with deleting entries
                        if ($items[0]['deleted']) {
@@ -158,6 +164,10 @@ class Delivery extends BaseObject
                        return;
                }
 
+               if (Network::isUrlBlocked($contact['url'])) {
+                       return;
+               }
+
                // Transmit via Diaspora if the thread had started as Diaspora post
                // This is done since the uri wouldn't match (Diaspora doesn't transmit it)
                if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {