Issue 4475: Don't create empty twitter quotes

This commit is contained in:
Michael 2018-08-26 04:31:29 +00:00
parent 4cae40ec63
commit 6175f07adf

View file

@ -817,6 +817,10 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
// We don't support nested shares, so we mustn't show quotes as shares on retweets // We don't support nested shares, so we mustn't show quotes as shares on retweets
$item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true); $item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true);
if (empty($item['body'])) {
return [];
}
$datarray['body'] = "\n" . share_header( $datarray['body'] = "\n" . share_header(
$item['author-name'], $item['author-name'],
$item['author-link'], $item['author-link'],
@ -830,6 +834,10 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
} else { } else {
$item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false); $item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false);
if (empty($item['body'])) {
return [];
}
$datarray['body'] = $item['body']; $datarray['body'] = $item['body'];
} }
@ -907,6 +915,10 @@ function twitter_fetchtimeline(App $a, $uid)
$_REQUEST = twitter_do_mirrorpost($a, $uid, $post); $_REQUEST = twitter_do_mirrorpost($a, $uid, $post);
if (empty($_REQUEST['body'])) {
continue;
}
logger('twitter: posting for user ' . $uid); logger('twitter: posting for user ' . $uid);
item_post($a); item_post($a);
@ -1467,6 +1479,10 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
if (!empty($post->retweeted_status)) { if (!empty($post->retweeted_status)) {
$retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote); $retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote);
if (empty($retweet['body'])) {
return [];
}
$retweet['source'] = $postarray['source']; $retweet['source'] = $postarray['source'];
$retweet['private'] = $postarray['private']; $retweet['private'] = $postarray['private'];
$retweet['allow_cid'] = $postarray['allow_cid']; $retweet['allow_cid'] = $postarray['allow_cid'];
@ -1481,6 +1497,10 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl
if (!empty($post->quoted_status) && !$noquote) { if (!empty($post->quoted_status) && !$noquote) {
$quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true); $quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true);
if (empty($quoted['body'])) {
return [];
}
$postarray['body'] = $statustext; $postarray['body'] = $statustext;
$postarray['body'] .= "\n" . share_header( $postarray['body'] .= "\n" . share_header(