Merge pull request #987 from MrPetovan/bug/8744-twitter-add-link-suppressed-quote

[twitter] Add a link to the quoted tweet when we don't add a share block
This commit is contained in:
Michael Vogel 2020-06-07 07:18:54 +02:00 committed by GitHub
commit 318e351860
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,6 @@ use Friendica\Model\Item;
use Friendica\Model\ItemContent; use Friendica\Model\ItemContent;
use Friendica\Model\ItemURI; use Friendica\Model\ItemURI;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Model\Term;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\ConfigFileLoader; use Friendica\Util\ConfigFileLoader;
@ -1609,9 +1608,12 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
} }
} }
if (!empty($post->quoted_status) && !$noquote) { if (!empty($post->quoted_status)) {
if ($noquote) {
// To avoid recursive share blocks we just provide the link to avoid removing quote context.
$postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str;
} else {
$quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true, $uriid); $quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true, $uriid);
if (!empty($quoted['body'])) { if (!empty($quoted['body'])) {
$postarray['body'] .= "\n" . share_header( $postarray['body'] .= "\n" . share_header(
$quoted['author-name'], $quoted['author-name'],
@ -1628,6 +1630,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
$postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str; $postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str;
} }
} }
}
return $postarray; return $postarray;
} }