[ActivityPub] Properly handle Actor URIs by using events correctly

This should fix nulls on explorer lookups inputed by postman after generate_followers/getSubscribers, that I think were caused by calling common_profile_uri that, curiously, only handles local profiles
This commit is contained in:
Diogo Cordeiro
2019-12-10 22:27:32 +00:00
parent b730582336
commit 80ba2b3ccc
13 changed files with 37 additions and 66 deletions

View File

@@ -86,7 +86,7 @@ class Activitypub_profile extends Managed_DataObject
*/
public static function profile_to_array($profile)
{
$uri = ActivityPubPlugin::actor_uri($profile);
$uri = $profile->getUri();
$id = $profile->getID();
$rsa = new Activitypub_rsa();
$public_key = $rsa->ensure_public_key($profile);
@@ -589,20 +589,16 @@ class Activitypub_profile extends Managed_DataObject
}
$subs = Subscription::getSubscriberIDs($profile->id, $offset, $limit);
try {
$profiles = [];
$profiles = [];
$users = User::multiGet('id', $subs);
foreach ($users->fetchAll() as $user) {
$profiles[$user->id] = $user->getProfile();
}
$users = User::multiGet('id', $subs);
foreach ($users->fetchAll() as $user) {
$profiles[$user->id] = $user->getProfile();
}
$ap_profiles = Activitypub_profile::multiGet('profile_id', $subs);
foreach ($ap_profiles->fetchAll() as $ap) {
$profiles[$ap->getID()] = $ap->local_profile();
}
} catch (NoResultException $e) {
return $e->obj;
$ap_profiles = Activitypub_profile::multiGet('profile_id', $subs);
foreach ($ap_profiles->fetchAll() as $ap) {
$profiles[$ap->getID()] = $ap->local_profile();
}
if ($cache) {