]> git.mxchange.org Git - friendica.git/commitdiff
Move user tombstone activity data to ActivityPub\Transmitter
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 4 Apr 2019 11:38:40 +0000 (07:38 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Thu, 4 Apr 2019 11:38:40 +0000 (07:38 -0400)
src/Module/Profile.php
src/Protocol/ActivityPub/Transmitter.php

index 62598400d4a281de7768cda81a054a90e7300620..55150a9649d8d1d741008945d041c95e419e5bfe 100644 (file)
@@ -63,14 +63,7 @@ class Profile extends BaseModule
                                System::jsonExit($data, 'application/activity+json');\r
                        } elseif (DBA::exists('userd', ['username' => self::$which])) {\r
                                // Known deleted user\r
-                               $data = [\r
-                                       '@context' => ActivityPub::CONTEXT,\r
-                                       'id' => self::getApp()->getBaseUrl() . '/profile/' . self::$which,\r
-                                       'type' => 'Tombstone',\r
-                                       'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),\r
-                                       'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),\r
-                                       'deleted' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),\r
-                               ];\r
+                               $data = ActivityPub\Transmitter::getDeletedUser(self::$which);\r
 \r
                                System::jsonError(410, $data);\r
                        } else {\r
index eb1da09b3a9a6e8eea5b915e7642d5ccf93b6ae8..6e7bc73a5aeacfeea25bd31c1baf351c85ecd87b 100644 (file)
@@ -247,6 +247,23 @@ class Transmitter
                return $data;
        }
 
+       /**
+        * @param string $username
+        * @return array
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        */
+       public static function getDeletedUser($username)
+       {
+               return [
+                       '@context' => ActivityPub::CONTEXT,
+                       'id' => System::baseUrl() . '/profile/' . $username,
+                       'type' => 'Tombstone',
+                       'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
+                       'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
+                       'deleted' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
+               ];
+       }
+
        /**
         * Returns an array with permissions of a given item array
         *