]> git.mxchange.org Git - friendica.git/commitdiff
Fix Mastodon InstanceV2 structure needs image max size under mediaAttachment
authorHank Grabowski <hankgrabowski@gmail.com>
Fri, 17 Mar 2023 19:56:42 +0000 (15:56 -0400)
committerHank Grabowski <hankgrabowski@gmail.com>
Fri, 17 Mar 2023 19:56:42 +0000 (15:56 -0400)
src/Module/Api/Mastodon/InstanceV2.php
src/Object/Api/Mastodon/InstanceV2/Configuration.php
src/Object/Api/Mastodon/InstanceV2/MediaAttachmentsConfig.php

index 2038081d87edf4b3d21c36afab021cac5bf183f6..e006c8263f061ac3d4c426f634d6ef188d70d218 100644 (file)
@@ -112,10 +112,11 @@ class InstanceV2 extends BaseApi
                        $this->config->get('config', 'max_import_size')
                ));
 
+               $image_size_limit = $this->config->get('system', 'maximagesize');
+
                return new InstanceEntity\Configuration(
                        $statuses_config,
-                       new InstanceEntity\MediaAttachmentsConfig(Images::supportedTypes()),
-                       $this->config->get('system', 'maximagesize')
+                       new InstanceEntity\MediaAttachmentsConfig(Images::supportedTypes(), $image_size_limit),
                );
        }
 
index a44c2e060ff012db6fa99b64bf47c14165c9ddde..276dece28074f1e9697984eff30ef506a16fb4f9 100644 (file)
@@ -34,21 +34,16 @@ class Configuration extends BaseDataTransferObject
        protected $statuses;
        /** @var MediaAttachmentsConfig */
        protected $media_attachments;
-       /** @var int */
-       protected $image_size_limit;
 
        /**
         * @param StatusesConfig $statuses
         * @param MediaAttachmentsConfig $media_attachments
-        * @param int $image_size_limit
         */
        public function __construct(
                StatusesConfig $statuses,
-               MediaAttachmentsConfig $media_attachments,
-               int $image_size_limit
+               MediaAttachmentsConfig $media_attachments
        ) {
                $this->statuses          = $statuses;
                $this->media_attachments = $media_attachments;
-               $this->image_size_limit  = $image_size_limit;
        }
 }
index 085bdfd0e28729505fc7aed88a6af012540f33b5..3301ed7be2159cf780c9834f06d2069c3757615f 100644 (file)
@@ -32,12 +32,15 @@ class MediaAttachmentsConfig extends BaseDataTransferObject
 {
        /** @var string[] */
        protected $supported_mime_types;
+       /** @var int */
+       protected $image_size_limit;
 
        /**
         * @param array $supported_mime_types
         */
-       public function __construct(array $supported_mime_types)
+       public function __construct(array $supported_mime_types, int $image_size_limit)
        {
                $this->supported_mime_types = $supported_mime_types;
+               $this->image_size_limit     = $image_size_limit;
        }
 }