]> git.mxchange.org Git - friendica.git/commitdiff
Fix pixture posts to connectors / fix delivery counter for connector posts
authorMichael <heluecht@pirati.ca>
Tue, 11 Jun 2019 19:35:03 +0000 (19:35 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 11 Jun 2019 19:35:03 +0000 (19:35 +0000)
src/Content/Text/BBCode.php
src/Worker/Notifier.php

index 0d83b665cdc13256245cb0c69b60c02ab4535997..7560019aeec69044ab0486198090a69303399936 100644 (file)
@@ -252,7 +252,9 @@ class BBCode extends BaseObject
                        if (preg_match_all("(\[url=([$URLSearchString]*)\]\s*\[img\]([$URLSearchString]*)\[\/img\]\s*\[\/url\])ism", $body, $pictures, PREG_SET_ORDER)) {
                                if ((count($pictures) == 1) && !$has_title) {
                                        if (!empty($item['object-type']) && ($item['object-type'] == ACTIVITY_OBJ_IMAGE)) {
-                                               $data = ['url' => $pictures[0][1], 'type' => 'photo'];
+                                               // Replace the preview picture with the real picture
+                                               $url = str_replace('-1.', '-0.', $pictures[0][2]);
+                                               $data = ['url' => $url, 'type' => 'photo'];
                                        } else {
                                                // Checking, if the link goes to a picture
                                                $data = ParseUrl::getSiteinfoCached($pictures[0][1], true);
index a677cef60442fcd4fd873bc72e8c1ce3a8425a54..36c6e92a04d9a20ff7dd4cc589f365c7d9b8e621 100644 (file)
@@ -529,13 +529,19 @@ class Notifier
                if (!empty($target_item)) {
                        Logger::log('Calling hooks for ' . $cmd . ' ' . $target_id, Logger::DEBUG);
 
-                       if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
-                               ItemDeliveryData::update($target_item['id'], ['queue_count' => $delivery_queue_count]);
-                       }
-
                        Hook::fork($a->queue['priority'], 'notifier_normal', $target_item);
 
                        Hook::callAll('notifier_end', $target_item);
+
+                       // Workaround for pure connector posts
+                       if ($delivery_queue_count == 0) {
+                               ItemDeliveryData::incrementQueueDone($target_item['id']);
+                               $delivery_queue_count = 1;
+                       }
+
+                       if (in_array($cmd, [Delivery::POST, Delivery::POKE])) {
+                               ItemDeliveryData::update($target_item['id'], ['queue_count' => $delivery_queue_count]);
+                       }
                }
 
                return;