[ActivityPub] Fix use of ActivityPubPlugin::pull_remote_profile

It does not throw but return null.
This commit is contained in:
Alexei Sorokin 2020-09-14 20:48:10 +03:00
parent d2c7d70f49
commit 647bf8c953
1 changed files with 7 additions and 9 deletions

View File

@ -752,10 +752,10 @@ class ActivityPubPlugin extends Plugin
*/ */
public function onStartCommandGetProfile($command, $arg, &$profile) public function onStartCommandGetProfile($command, $arg, &$profile)
{ {
try { $aprofile = self::pull_remote_profile($arg);
$aprofile = $this->pull_remote_profile($arg); if ($aprofile instanceof Activitypub_profile) {
$profile = $aprofile->local_profile(); $profile = $aprofile->local_profile();
} catch (Exception $e) { } else {
// No remote ActivityPub profile found // No remote ActivityPub profile found
return true; return true;
} }
@ -795,12 +795,10 @@ class ActivityPubPlugin extends Plugin
*/ */
public function onRemoteFollowPullProfile(string $uri, ?Profile &$profile): bool public function onRemoteFollowPullProfile(string $uri, ?Profile &$profile): bool
{ {
try { $aprofile = self::pull_remote_profile($uri);
$aprofile = $this->pull_remote_profile($uri); if ($aprofile instanceof Activitypub_profile) {
if ($aprofile instanceof Activitypub_profile) { $profile = $aprofile->local_profile();
$profile = $aprofile->local_profile(); } else {
}
} catch (Exception $e) {
// No remote ActivityPub profile found // No remote ActivityPub profile found
return true; return true;
} }