Move sending follow message to remote server to Protocol class

This commit is contained in:
Hypolite Petovan 2021-11-07 01:57:18 -04:00
parent 8c8c6fe720
commit 84e7f65d52
3 changed files with 64 additions and 53 deletions

View file

@ -40,8 +40,14 @@ class Follow extends BaseApi
DI::mstdnError()->UnprocessableEntity();
}
$cid = Contact::follow($this->parameters['id'], $uid);
$contact = Contact::getById($this->parameters['id'], ['url']);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
$result = Contact::createFromProbeForUser($uid, $contact['url']);
if (!$result['success']) {
DI::mstdnError()->UnprocessableEntity($result['message']);
}
System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray());
}
}