mirror of
https://github.com/friendica/friendica
synced 2024-11-19 10:23:41 +00:00
Add tombstone object for AP response on deleted profile
- Responds with 404 status code with all other non-success cases
This commit is contained in:
parent
9f49ce8857
commit
e911302fe9
1 changed files with 16 additions and 3 deletions
|
@ -54,15 +54,28 @@ class Profile extends BaseModule
|
||||||
{
|
{
|
||||||
if (ActivityPub::isRequest()) {
|
if (ActivityPub::isRequest()) {
|
||||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
|
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
|
||||||
|
$data = [];
|
||||||
if (DBA::isResult($user)) {
|
if (DBA::isResult($user)) {
|
||||||
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data)) {
|
||||||
System::jsonExit($data, 'application/activity+json');
|
System::jsonExit($data, 'application/activity+json');
|
||||||
} elseif (DBA::exists('userd', ['username' => self::$which])) {
|
} elseif (DBA::exists('userd', ['username' => self::$which])) {
|
||||||
// Known deleted user
|
// Known deleted user
|
||||||
System::httpExit(410);
|
$data = [
|
||||||
|
'@context' => ActivityPub::CONTEXT,
|
||||||
|
'id' => System::baseUrl() . '/profile/' . self::$which,
|
||||||
|
'type' => 'Tombstone',
|
||||||
|
'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||||
|
'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||||
|
'deleted' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||||
|
];
|
||||||
|
|
||||||
|
System::jsonError(410, $data);
|
||||||
} else {
|
} else {
|
||||||
// Unknown user
|
// Any other case (unknown, blocked, unverified, expired, no profile, no self contact)
|
||||||
System::httpExit(404);
|
System::jsonError(404, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue