]> git.mxchange.org Git - friendica.git/commitdiff
Fix test / Use new expandTags function
authorMichael <heluecht@pirati.ca>
Wed, 2 Mar 2022 17:17:07 +0000 (17:17 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 2 Mar 2022 17:17:07 +0000 (17:17 +0000)
src/Module/Api/Mastodon/Statuses.php
src/Module/Api/Twitter/Statuses/Update.php

index 7bf40c837e60f908f221ff5d76d44ed02c1fa31c..1dd36f16b3ed7b35dd8fe264f70d0d679ab9052e 100644 (file)
@@ -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;
index 6ee305d19df143eb8a3a00594458cac4a6676802..c2b830b661e153d068940f715725b96e75f19650 100644 (file)
@@ -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'];