Merge pull request #7626 from annando/issue-6553

Issue 6553: Restructured code for treating removed accounts
2022.09-rc
Tobias Diekershoff 2019-09-14 09:48:38 +02:00 zatwierdzone przez GitHub
commit a78ffd5b7e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -57,21 +57,22 @@ 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)) {
// The function returns an empty array when the account is removed, expired or blocked
$data = ActivityPub\Transmitter::getProfile($user['uid']); $data = ActivityPub\Transmitter::getProfile($user['uid']);
if (!empty($data)) {
System::jsonExit($data, 'application/activity+json');
}
} }
if (!empty($data)) { if (DBA::exists('userd', ['username' => self::$which])) {
System::jsonExit($data, 'application/activity+json');
} elseif (DBA::exists('userd', ['username' => self::$which])) {
// Known deleted user // Known deleted user
$data = ActivityPub\Transmitter::getDeletedUser(self::$which); $data = ActivityPub\Transmitter::getDeletedUser(self::$which);
System::jsonError(410, $data); System::jsonError(410, $data);
} else { } else {
// Any other case (unknown, blocked, unverified, expired, no profile, no self contact) // Any other case (unknown, blocked, unverified, expired, no profile, no self contact)
System::jsonError(404, $data); System::jsonError(404, []);
} }
} }
} }