]> git.mxchange.org Git - friendica.git/commitdiff
Ensure not to add the plink
authorMichael <heluecht@pirati.ca>
Sat, 1 Oct 2022 16:54:11 +0000 (16:54 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 1 Oct 2022 16:54:11 +0000 (16:54 +0000)
src/Content/Text/Plaintext.php

index 75fdf2b2bbf6b6fc2adf794a597da939a0947e11..1e76a557bc43a0311ce0b69f4ab39eff00753c0e 100644 (file)
@@ -223,8 +223,6 @@ class Plaintext
                                                unset($post['url']);
                                        }
                                }
-                       } elseif ($link != '') {
-                               $complete_msg .= "\n" . $link;
                        }
                }
 
@@ -240,6 +238,12 @@ class Plaintext
                                $limit = $limit - 23;
                        }
 
+                       if (!in_array($link, ['', $item['plink']]) && ($post['type'] != 'photo')) {
+                               $complete_msg .= "\n" . $link;
+                       }
+
+                       $post['parts'] = self::getParts(trim($complete_msg), $limit);
+
                        if (iconv_strlen($msg, 'UTF-8') > $limit) {
                                if (($post['type'] == 'text') && isset($post['url'])) {
                                        $post['url'] = $item['plink'];
@@ -255,10 +259,6 @@ class Plaintext
                        }
                }
 
-               if ($limit > 0) {
-                       $post['parts'] = self::getParts(trim($complete_msg), $limit);
-               }
-
                $post['text'] = trim($msg);
 
                return $post;