From: Hypolite Petovan Date: Thu, 4 Apr 2019 11:38:40 +0000 (-0400) Subject: Move user tombstone activity data to ActivityPub\Transmitter X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5b12bccb457511924686979348104cb447aacd26;p=friendica.git Move user tombstone activity data to ActivityPub\Transmitter --- diff --git a/src/Module/Profile.php b/src/Module/Profile.php index 62598400d4..55150a9649 100644 --- a/src/Module/Profile.php +++ b/src/Module/Profile.php @@ -63,14 +63,7 @@ class Profile extends BaseModule System::jsonExit($data, 'application/activity+json'); } elseif (DBA::exists('userd', ['username' => self::$which])) { // Known deleted user - $data = [ - '@context' => ActivityPub::CONTEXT, - 'id' => self::getApp()->getBaseUrl() . '/profile/' . self::$which, - 'type' => 'Tombstone', - 'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), - 'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), - 'deleted' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), - ]; + $data = ActivityPub\Transmitter::getDeletedUser(self::$which); System::jsonError(410, $data); } else { diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index eb1da09b3a..6e7bc73a5a 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -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 *