]> git.mxchange.org Git - friendica.git/commitdiff
Don't publish some fields
authorMichael <heluecht@pirati.ca>
Sun, 25 Oct 2020 17:42:42 +0000 (17:42 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 25 Oct 2020 17:42:42 +0000 (17:42 +0000)
src/Object/Api/Mastodon/Account.php
src/Object/Api/Mastodon/Status.php

index f6e66941ac7094a4d3f3c9dfda1e8aad1857c8f0..587c6ce6d4e3ad5fcaaefcad0b566ff31c4da52c 100644 (file)
@@ -132,4 +132,20 @@ class Account extends BaseEntity
                $this->fields          = $fields->getArrayCopy();
 
        }
+
+       /**
+        * Returns the current entity as an array
+        *
+        * @return array
+        */
+       public function toArray()
+       {
+               $account = parent::toArray();
+
+               if (empty($account['moved'])) {
+                       unset($account['moved']);
+               }
+
+               return $account;
+       }
 }
index cc9108fc8cfcbaadf9e817f8fe650ef382fd6dfe..2d2beb583f64d36cfe0158c27d9f1f866ec24dbd 100644 (file)
@@ -137,4 +137,24 @@ class Status extends BaseEntity
                $this->card = $card->toArray();
                $this->poll = null;
        }
+
+       /**
+        * Returns the current entity as an array
+        *
+        * @return array
+        */
+       public function toArray()
+       {
+               $status = parent::toArray();
+
+               if (!$status['pinned']) {
+                       unset($status['pinned']);
+               }
+
+               if (empty($status['application']['name'])) {
+                       unset($status['application']);
+               }
+
+               return $status;
+       }
 }