]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Conversation.php
Remove next link when there aren't any introductions in Module\Api\Mastodon\FollowReq...
[friendica.git] / src / Model / Conversation.php
index 06d3ba536d0567544af65558a85dc74d14eb47f3..78faaddf6825dad0a8142647e69543d5ee6cf8bb 100644 (file)
@@ -31,7 +31,7 @@ class Conversation
        }
 
        /**
-        * @brief Store the conversation data
+        * Store the conversation data
         *
         * @param array $arr Item array with conversation data
         * @return array Item array with removed conversation data
@@ -39,7 +39,7 @@ class Conversation
         */
        public static function insert(array $arr)
        {
-               if (in_array(defaults($arr, 'network', Protocol::PHANTOM),
+               if (in_array(($arr['network'] ?? '') ?: Protocol::PHANTOM,
                        [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::TWITTER]) && !empty($arr['uri'])) {
                        $conversation = ['item-uri' => $arr['uri'], 'received' => DateTimeFormat::utcNow()];
 
@@ -76,8 +76,13 @@ class Conversation
                                        unset($old_conv['source']);
                                }
                                // Update structure data all the time but the source only when its from a better protocol.
-                               if (empty($conversation['source']) || (!empty($old_conv['source']) &&
-                                       ($old_conv['protocol'] < defaults($conversation, 'protocol', self::PARCEL_UNKNOWN)))) {
+                               if (
+                                       empty($conversation['source'])
+                                       || (
+                                               !empty($old_conv['source'])
+                                               && ($old_conv['protocol'] < (($conversation['protocol'] ?? '') ?: self::PARCEL_UNKNOWN))
+                                       )
+                               ) {
                                        unset($conversation['protocol']);
                                        unset($conversation['source']);
                                }