]> git.mxchange.org Git - friendica.git/commitdiff
Quote for notifications
authorMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 20:35:10 +0000 (20:35 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 20:35:10 +0000 (20:35 +0000)
src/Factory/Api/Mastodon/Notification.php
src/Factory/Api/Mastodon/Status.php
src/Module/Api/Mastodon/Notifications.php

index 7a134003bced1a4a54ac0484132ad1be5c7e00e1..52241e1fc8824797952eabcb7bb5704057ea9150 100644 (file)
@@ -47,11 +47,12 @@ class Notification extends BaseFactory
 
        /**
         * @param Notifications\Entity\Notification $Notification
+        * @param bool $display_quote Display quoted posts
         *
         * @return MstdnNotification
         * @throws UnexpectedNotificationTypeException
         */
-       public function createFromNotification(Notifications\Entity\Notification $Notification): MstdnNotification
+       public function createFromNotification(Notifications\Entity\Notification $Notification, bool $display_quotes): MstdnNotification
        {
                $type = self::getType($Notification);
                if (empty($type)) {
@@ -62,7 +63,7 @@ class Notification extends BaseFactory
 
                if ($Notification->targetUriId) {
                        try {
-                               $status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid);
+                               $status = $this->mstdnStatusFactory->createFromUriId($Notification->targetUriId, $Notification->uid, $display_quotes);
                        } catch (\Throwable $th) {
                                $status = null;
                        }
index ad2d9bab35ef616fcf0b21be6716988d6667c5e8..1409a7ab2fa3a35917d1ce3f72a5f1ed7a67cc96 100644 (file)
@@ -87,7 +87,7 @@ class Status extends BaseFactory
         * @throws HTTPException\InternalServerErrorException
         * @throws ImagickException|HTTPException\NotFoundException
         */
-       public function createFromUriId(int $uriId, int $uid = 0, bool $display_quote = false, bool $reblog = true, bool $in_reply_status = true): \Friendica\Object\Api\Mastodon\Status
+       public function createFromUriId(int $uriId, int $uid = 0, bool $display_quote, bool $reblog = true, bool $in_reply_status = true): \Friendica\Object\Api\Mastodon\Status
        {
                $fields = ['uri-id', 'uid', 'author-id', 'causer-id', 'author-uri-id', 'author-link', 'causer-uri-id', 'post-reason', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id',
                        'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media', 'quote-uri-id'];
index 39c111e9258c294b9e6728444c85c27564a630d7..c46cbe1e6066095df74635193fac0553588015a2 100644 (file)
@@ -49,7 +49,7 @@ class Notifications extends BaseApi
                        $id = $this->parameters['id'];
                        try {
                                $notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
-                               System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));
+                               System::jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes()));
                        } catch (\Exception $e) {
                                DI::mstdnError()->RecordNotFound();
                        }
@@ -134,7 +134,7 @@ class Notifications extends BaseApi
 
                foreach($Notifications as $Notification) {
                        try {
-                               $mstdnNotifications[] = DI::mstdnNotification()->createFromNotification($Notification);
+                               $mstdnNotifications[] = DI::mstdnNotification()->createFromNotification($Notification, self::appSupportsQuotes());
                                self::setBoundaries($Notification->id);
                        } catch (\Exception $e) {
                                // Skip this notification