Merge pull request #3695 from annando/repeat-picture

OStatus: Attached pictures now show up in repeated posts as well.
This commit is contained in:
Tobias Diekershoff 2017-09-09 10:41:58 +02:00 committed by GitHub
commit a6e1f9c89d

View file

@ -458,6 +458,8 @@ class ostatus {
$self = ""; $self = "";
$add_body = "";
$links = $xpath->query('atom:link', $entry); $links = $xpath->query('atom:link', $entry);
if ($links) { if ($links) {
foreach ($links AS $link) { foreach ($links AS $link) {
@ -482,7 +484,7 @@ class ostatus {
case "enclosure": case "enclosure":
$filetype = strtolower(substr($attribute['type'], 0, strpos($attribute['type'],'/'))); $filetype = strtolower(substr($attribute['type'], 0, strpos($attribute['type'],'/')));
if ($filetype == 'image') { if ($filetype == 'image') {
$item['body'] .= "\n[img]".$attribute['href'].'[/img]'; $add_body .= "\n[img]".$attribute['href'].'[/img]';
} else { } else {
if (strlen($item["attach"])) { if (strlen($item["attach"])) {
$item["attach"] .= ','; $item["attach"] .= ',';
@ -519,18 +521,6 @@ class ostatus {
} }
} }
// Only add additional data when there is no picture in the post
if (!strstr($item["body"],'[/img]')) {
$item["body"] = add_page_info_to_body($item["body"]);
}
// Mastodon Content Warning
if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
}
$local_id = ""; $local_id = "";
$repeat_of = ""; $repeat_of = "";
@ -587,7 +577,7 @@ class ostatus {
$item["author-link"] = $orig_author["author-link"]; $item["author-link"] = $orig_author["author-link"];
$item["author-avatar"] = $orig_author["author-avatar"]; $item["author-avatar"] = $orig_author["author-avatar"];
$item["body"] = add_page_info_to_body(html2bbcode($orig_body)); $item["body"] = html2bbcode($orig_body);
$item["created"] = $orig_created; $item["created"] = $orig_created;
$item["edited"] = $orig_edited; $item["edited"] = $orig_edited;
@ -622,6 +612,20 @@ class ostatus {
} }
} }
$item["body"] .= $add_body;
// Only add additional data when there is no picture in the post
if (!strstr($item["body"],'[/img]')) {
$item["body"] = add_page_info_to_body($item["body"]);
}
// Mastodon Content Warning
if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
}
if (isset($item["parent-uri"])) { if (isset($item["parent-uri"])) {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'", $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
intval($importer["uid"]), dbesc($item["parent-uri"])); intval($importer["uid"]), dbesc($item["parent-uri"]));