Browse Source

Move user tombstone activity data to ActivityPub\Transmitter

pull/6957/head
Hypolite Petovan 2 years ago
parent
commit
5b12bccb45
2 changed files with 18 additions and 8 deletions
  1. +1
    -8
      src/Module/Profile.php
  2. +17
    -0
      src/Protocol/ActivityPub/Transmitter.php

+ 1
- 8
src/Module/Profile.php View File

@ -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 {


+ 17
- 0
src/Protocol/ActivityPub/Transmitter.php View 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
*


Loading…
Cancel
Save