mirror of
https://github.com/friendica/friendica
synced 2025-04-27 09:50:12 +00:00
Diaspora: Reshares are now working more reliable
This commit is contained in:
parent
6e06169565
commit
5c4d55c5e8
2 changed files with 190 additions and 91 deletions
|
@ -2067,7 +2067,7 @@
|
|||
$ret = Array();
|
||||
|
||||
foreach($r as $item) {
|
||||
api_share_as_retweet($a, api_user(), $item);
|
||||
api_share_as_retweet($item);
|
||||
|
||||
localize_item($item);
|
||||
$status_user = api_item_get_user($a,$item);
|
||||
|
@ -2619,7 +2619,7 @@
|
|||
|
||||
|
||||
|
||||
function api_share_as_retweet($a, $uid, &$item) {
|
||||
function api_share_as_retweet(&$item) {
|
||||
$body = trim($item["body"]);
|
||||
|
||||
// Skip if it isn't a pure repeated messages
|
||||
|
@ -2663,6 +2663,15 @@ function api_share_as_retweet($a, $uid, &$item) {
|
|||
if ($matches[1] != "")
|
||||
$avatar = $matches[1];
|
||||
|
||||
$link = "";
|
||||
preg_match("/link='(.*?)'/ism", $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$link = $matches[1];
|
||||
|
||||
preg_match('/link="(.*?)"/ism', $attributes, $matches);
|
||||
if ($matches[1] != "")
|
||||
$link = $matches[1];
|
||||
|
||||
$shared_body = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism","$2",$body);
|
||||
|
||||
if (($shared_body == "") OR ($profile == "") OR ($author == "") OR ($avatar == ""))
|
||||
|
@ -2672,6 +2681,7 @@ function api_share_as_retweet($a, $uid, &$item) {
|
|||
$item["author-name"] = $author;
|
||||
$item["author-link"] = $profile;
|
||||
$item["author-avatar"] = $avatar;
|
||||
$item["plink"] = $link;
|
||||
|
||||
return(true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue