X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FProtocol%2FDiaspora.php;h=12f4115384e938bb9c01ff8cd9f770136db15074;hb=1f3b9ab45161e1493c9f3fa664cfb85cd214c43b;hp=3687fb9d4b537e75e4ef0dc30c1d8f00c2c3c141;hpb=8c1db51a760dd60745c55592fd08dee03c2d8a52;p=friendica.git diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 3687fb9d4b..12f4115384 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -1135,8 +1135,11 @@ class Diaspora // Logger::log("defining user ".$contact["nick"]." as friend"); //} - // We don't seem to like that person - if ($contact["blocked"]) { + // Contact server is blocked + if (Network::isUrlBlocked($contact['url'])) { + return false; + // We don't seem to like that person + } elseif ($contact["blocked"]) { // Maybe blocked, don't accept. return false; // We are following this person? @@ -3675,7 +3678,7 @@ class Diaspora && !strstr($body, $profile['addr']) && !strstr($body, $profile_url) ) { - $body = '@[url=' . $profile_url . ']' . $profile['nick'] . '[/url] ' . $body; + $body = '@[url=' . $profile_url . ']' . $profile['name'] . '[/url] ' . $body; } return $body; @@ -3776,7 +3779,7 @@ class Diaspora * @param array $item The item that will be exported * @param array $owner the array of the item owner * - * @return array The data for a comment + * @return array|false The data for a comment * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function constructComment(array $item, array $owner) @@ -3788,30 +3791,40 @@ class Diaspora return $result; } - $parent = Item::selectFirst(['guid', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]); - if (!DBA::isResult($parent)) { + $toplevel_item = Item::selectFirst(['guid', 'author-link'], ['id' => $item["parent"], 'parent' => $item["parent"]]); + if (!DBA::isResult($toplevel_item)) { + Logger::error('Missing parent conversation item', ['parent' => $item["parent"]]); return false; } + $thread_parent_item = $toplevel_item; + if ($item['thr-parent'] != $item['parent-uri']) { + $thread_parent_item = Item::selectFirst(['guid', 'author-link'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]); + } + $body = $item["body"]; - if (empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) { - $body = self::prependParentAuthorMention($body, $parent['author-link']); + if ((empty($item['uid']) || !Feature::isEnabled($item['uid'], 'explicit_mentions')) + && !Config::get('system', 'disable_implicit_mentions') + ) { + $body = self::prependParentAuthorMention($body, $thread_parent_item['author-link']); } $text = html_entity_decode(BBCode::toMarkdown($body)); $created = DateTimeFormat::utc($item["created"], DateTimeFormat::ATOM); - $comment = ["author" => self::myHandle($owner), - "guid" => $item["guid"], - "created_at" => $created, - "parent_guid" => $parent["guid"], - "text" => $text, - "author_signature" => ""]; + $comment = [ + "author" => self::myHandle($owner), + "guid" => $item["guid"], + "created_at" => $created, + "parent_guid" => $toplevel_item["guid"], + "text" => $text, + "author_signature" => "" + ]; // Send the thread parent guid only if it is a threaded comment if ($item['thr-parent'] != $item['parent-uri']) { - $comment['thread_parent_guid'] = self::getGuidFromUri($item['thr-parent'], $item['uid']); + $comment['thread_parent_guid'] = $thread_parent_item['guid']; } Cache::set($cachekey, $comment, Cache::QUARTER_HOUR);