Merge pull request #1174 from annando/issue-10772

Issue 10772: Avoid duplicated links to Twitter
This commit is contained in:
Hypolite Petovan 2021-09-28 07:02:18 -04:00 committed by GitHub
commit 9682cc7dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -680,7 +680,7 @@ function twitter_post_hook(App $a, array &$b)
}
// 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))) {
if (!empty($msgarr['url']) && (strpos($msg, $msgarr['url']) === false) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) {
$msg .= "\n" . $msgarr['url'];
}