From f226a424430d56f940ad3218060d0ea1f3ef46dc Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Apr 2019 05:51:26 +0000 Subject: [PATCH] Twitter: Use the new reshare mechanism for retweets --- twitter/twitter.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/twitter/twitter.php b/twitter/twitter.php index 99bed6e2..2d331a7d 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1558,15 +1558,28 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl return []; } - $retweet['source'] = $postarray['source']; - $retweet['private'] = $postarray['private']; - $retweet['allow_cid'] = $postarray['allow_cid']; - $retweet['contact-id'] = $postarray['contact-id']; - $retweet['owner-name'] = $postarray['owner-name']; - $retweet['owner-link'] = $postarray['owner-link']; - $retweet['owner-avatar'] = $postarray['owner-avatar']; - - $postarray = $retweet; + if (!$noquote) { + // Store the original tweet + Item::insert($retweet); + + // CHange the other post into a reshare activity + $postarray['verb'] = ACTIVITY2_ANNOUNCE; + $postarray['gravity'] = GRAVITY_ACTIVITY; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; + + $postarray['thr-parent'] = $retweet['uri']; + $postarray['parent-uri'] = $retweet['uri']; + } else { + $retweet['source'] = $postarray['source']; + $retweet['private'] = $postarray['private']; + $retweet['allow_cid'] = $postarray['allow_cid']; + $retweet['contact-id'] = $postarray['contact-id']; + $retweet['owner-name'] = $postarray['owner-name']; + $retweet['owner-link'] = $postarray['owner-link']; + $retweet['owner-avatar'] = $postarray['owner-avatar']; + + $postarray = $retweet; + } } if (!empty($post->quoted_status) && !$noquote) { -- 2.39.5