]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/OStatus.php
Merge pull request #7288 from annando/fix-search
[friendica.git] / src / Protocol / OStatus.php
index 38105e452a929dbdf589675964837c4b7e4c39cb..9fa0ff43af73e9120122178142dba54257ee03e4 100644 (file)
@@ -417,13 +417,6 @@ class OStatus
                                $author = self::fetchAuthor($xpath, $entry, $importer, $contact, $stored);
                        }
 
-                       $value = XML::getFirstNodeValue($xpath, 'atom:author/poco:preferredUsername/text()', $entry);
-                       if ($value != "") {
-                               $nickname = $value;
-                       } else {
-                               $nickname = $author["author-name"];
-                       }
-
                        $item = array_merge($header, $author);
 
                        $item["uri"] = XML::getFirstNodeValue($xpath, 'atom:id/text()', $entry);
@@ -463,7 +456,7 @@ class OStatus
                        }
 
                        if ($item["verb"] == ACTIVITY_FOLLOW) {
-                               Contact::addRelationship($importer, $contact, $item, $nickname);
+                               Contact::addRelationship($importer, $contact, $item);
                                continue;
                        }
 
@@ -745,7 +738,7 @@ class OStatus
 
                self::$conv_list[$conversation] = true;
 
-               $curlResult = Network::curl($conversation, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+               $curlResult = Network::curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
 
                if (!$curlResult->isSuccess()) {
                        return;
@@ -938,7 +931,7 @@ class OStatus
                }
 
                $stored = false;
-               $curlResult = Network::curl($related, false, $redirects, ['accept_content' => 'application/atom+xml, text/html']);
+               $curlResult = Network::curl($related, false, ['accept_content' => 'application/atom+xml, text/html']);
 
                if (!$curlResult->isSuccess()) {
                        return;
@@ -1515,7 +1508,7 @@ class OStatus
                                $author->appendChild($urls);
                        }
 
-                       XML::addElement($doc, $author, "followers", "", ["url" => System::baseUrl()."/viewcontacts/".$owner["nick"]]);
+                       XML::addElement($doc, $author, "followers", "", ["url" => System::baseUrl() . "/profile/" . $owner["nick"] . "/contacts/followers"]);
                        XML::addElement($doc, $author, "statusnet:profile_info", "", ["local_id" => $owner["uid"]]);
 
                        if ($profile["publish"]) {
@@ -1763,19 +1756,16 @@ class OStatus
                $verb = NAMESPACE_ACTIVITY_SCHEMA."favorite";
                self::entryContent($doc, $entry, $item, $owner, "Favorite", $verb, false);
 
-               $as_object = $doc->createElement("activity:object");
-
                $parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]);
+               if (DBA::isResult($parent)) {
+                       $as_object = $doc->createElement("activity:object");
 
-               if (!$parent) {
-                       $parent = [];
-               }
-
-               XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent));
+                       XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent));
 
-               self::entryContent($doc, $as_object, $parent, $owner, "New entry");
+                       self::entryContent($doc, $as_object, $parent, $owner, "New entry");
 
-               $entry->appendChild($as_object);
+                       $entry->appendChild($as_object);
+               }
 
                self::entryFooter($doc, $entry, $item, $owner);