From f059e56e0f82e64024da7dcbb1ecac20ad84c1b5 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Mar 2022 17:17:07 +0000 Subject: [PATCH] Fix test / Use new expandTags function --- src/Module/Api/Mastodon/Statuses.php | 12 +++++------- src/Module/Api/Twitter/Statuses/Update.php | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 7bf40c837e..1dd36f16b3 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -21,8 +21,8 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Content\Text\BBCode; use Friendica\Content\Text\Markdown; +use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; @@ -63,12 +63,8 @@ class Statuses extends BaseApi // The imput is defined as text. So we can use Markdown for some enhancements $body = Markdown::toBBCode($request['status']); - // Avoids potential double expansion of existing links - $body = BBCode::performWithEscapedTags($body, ['url'], function ($body) { - return BBCode::expandTags($body); - }); - - $item = []; + $item = []; + $item['network'] = Protocol::DFRN; $item['uid'] = $uid; $item['verb'] = Activity::POST; $item['contact-id'] = $owner['id']; @@ -149,6 +145,8 @@ class Statuses extends BaseApi $item['object-type'] = Activity\ObjectType::NOTE; } + $item = DI::contentItem()->expandTags($item); + if (!empty($request['media_ids'])) { $item['object-type'] = Activity\ObjectType::IMAGE; $item['post-type'] = Item::PT_IMAGE; diff --git a/src/Module/Api/Twitter/Statuses/Update.php b/src/Module/Api/Twitter/Statuses/Update.php index 6ee305d19d..c2b830b661 100644 --- a/src/Module/Api/Twitter/Statuses/Update.php +++ b/src/Module/Api/Twitter/Statuses/Update.php @@ -21,9 +21,9 @@ namespace Friendica\Module\Api\Twitter\Statuses; -use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Content\Text\Markdown; +use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -79,11 +79,11 @@ class Update extends BaseApi } $item = []; + $item['network'] = Protocol::DFRN; $item['uid'] = $uid; $item['verb'] = Activity::POST; $item['contact-id'] = $owner['id']; - $item['author-id'] = Contact::getPublicIdByUserId($uid); - $item['owner-id'] = $item['author-id']; + $item['author-id'] = $item['owner-id'] = Contact::getPublicIdByUserId($uid); $item['title'] = $request['title']; $item['body'] = $body; $item['app'] = $request['source'];