Prevent users from following relay accounts (#13894)

This commit is contained in:
Michael Vogel 2024-02-13 06:50:46 +01:00 committed by GitHub
parent 262ca4131d
commit fad55e0948
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 26 deletions

View file

@ -3106,6 +3106,13 @@ class Contact
$ret['url'] = str_replace('?absolute=true', '', $ret['url']);
}
if (($protocol == Protocol::ACTIVITYPUB) && ($uid != 0)) {
if (APContact::isRelay(APContact::getByURL($ret['url']))) {
$result['message'] = DI::l10n()->t('This seems to be a relay account. They can\'t be followed by users.');
return $result;
}
}
// do we have enough information?
if (empty($protocol) || ($protocol == Protocol::PHANTOM) || (empty($ret['url']) && empty($ret['addr']))) {
$result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . '<br />';