]> git.mxchange.org Git - friendica-addons.git/commitdiff
Twitter: Posts are now with links again
authorMichael <heluecht@pirati.ca>
Mon, 7 Dec 2020 13:22:07 +0000 (13:22 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 7 Dec 2020 13:22:07 +0000 (13:22 +0000)
twitter/twitter.php

index 7c8f1a36fc5882c192d6279a8d0d8a129183c04e..5ebb831856281ef623c8f653a6a69e75a49b5c9a 100644 (file)
@@ -675,6 +675,11 @@ function twitter_post_hook(App $a, array &$b)
                        $msg = Plaintext::shorten($msgarr["title"], $max_char - 50);
                }
 
+               // Add the link to the body if the type isn't a photo or there are more than 4 images in the post
+               if (!empty($msgarr['url']) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) {
+                       $msg .= "\n" . $msgarr['url'];
+               }
+
                if (empty($msg)) {
                        Logger::notice('Empty message', ['id' => $b['id']]);
                        return;