]> git.mxchange.org Git - friendica.git/commitdiff
OStatus: Attached pictures now show up in repeated posts as well.
authorMichael <heluecht@pirati.ca>
Sat, 9 Sep 2017 07:43:50 +0000 (07:43 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 9 Sep 2017 07:43:50 +0000 (07:43 +0000)
include/ostatus.php

index 7fd920d635a7ca00d769d47cdc5a7a02896de652..1f81d9615746274b402171b95514b11c0a157d41 100644 (file)
@@ -458,6 +458,8 @@ class ostatus {
 
                        $self = "";
 
+                       $add_body = "";
+
                        $links = $xpath->query('atom:link', $entry);
                        if ($links) {
                                foreach ($links AS $link) {
@@ -482,7 +484,7 @@ class ostatus {
                                                        case "enclosure":
                                                                $filetype = strtolower(substr($attribute['type'], 0, strpos($attribute['type'],'/')));
                                                                if ($filetype == 'image') {
-                                                                       $item['body'] .= "\n[img]".$attribute['href'].'[/img]';
+                                                                       $add_body .= "\n[img]".$attribute['href'].'[/img]';
                                                                } else {
                                                                        if (strlen($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 = "";
                        $repeat_of = "";
 
@@ -587,7 +577,7 @@ class ostatus {
                                        $item["author-link"] = $orig_author["author-link"];
                                        $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["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"])) {
                                $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
                                        intval($importer["uid"]), dbesc($item["parent-uri"]));