Merge pull request #1052 from annando/twitter-links

Twitter: Posts are now with links again
pull/1053/head
Hypolite Petovan 2020-12-07 08:41:06 -05:00 committed by GitHub
commit 30364c8ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -675,6 +675,11 @@ function twitter_post_hook(App $a, array &$b)
$msg = Plaintext::shorten($msgarr["title"], $max_char - 50); $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)) { if (empty($msg)) {
Logger::notice('Empty message', ['id' => $b['id']]); Logger::notice('Empty message', ['id' => $b['id']]);
return; return;