1
1
Fork 0

Merge pull request #6957 from MrPetovan/bug/6943-add-tombstone

Send AP Tombstone activity on deleted profiles
This commit is contained in:
Michael Vogel 2019-04-04 22:27:49 +02:00 committed by GitHub
commit c439cb656a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 4 deletions

View file

@ -7,6 +7,7 @@ Version 2019.06 (UNRELEASED) (2019-06-?)
Fixed tag completion painfully slow [AlfredSK]
Fixed a regression in notifications [MrPetovan]
Fixed an issue with smilies and code blocks [MrPetovan]
Fixed an AP issue with unavailable local profiles [MrPetovan]
General Code cleaning and restructuring [nupplaphil]
Added frio color scheme sharing [JeroenED]
Added syslog and stream Logger [nupplaphil]
@ -14,7 +15,7 @@ Version 2019.06 (UNRELEASED) (2019-06-?)
Added collapsible panel for connector permission fields [MrPetovan]
Closed Issues:
6303, 6478, 6319, 6921, 6903
6303, 6478, 6319, 6921, 6903, 6943
Version 2019.03 (2019-03-22)
Friendica Core:

View file

@ -54,15 +54,21 @@ class Profile extends BaseModule
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
$data = [];
if (DBA::isResult($user)) {
$data = ActivityPub\Transmitter::getProfile($user['uid']);
}
if (!empty($data)) {
System::jsonExit($data, 'application/activity+json');
} elseif (DBA::exists('userd', ['username' => self::$which])) {
// Known deleted user
System::httpExit(410);
$data = ActivityPub\Transmitter::getDeletedUser(self::$which);
System::jsonError(410, $data);
} else {
// Unknown user
System::httpExit(404);
// Any other case (unknown, blocked, unverified, expired, no profile, no self contact)
System::jsonError(404, $data);
}
}
}

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
*