[TheFreeNetwork] Fix small logic issue regarding StartTFNLookup return

This commit is contained in:
Diogo Cordeiro 2020-07-05 18:26:49 +01:00 committed by Diogo Peralta Cordeiro
parent d81e795cc0
commit 8ec2af0020
3 changed files with 5 additions and 3 deletions

View File

@ -86,7 +86,7 @@ class TheFreeNetworkModule extends Module
$profile_id = $this->lookup($uri, $class, true);
}
return is_null($profile_id);
return false;
}
/**

View File

@ -148,7 +148,8 @@ class Activitypub_profile extends Managed_DataObject
public function do_insert()
{
// Does any other protocol have this remote entity we're about to add ?
if (!Event::handle('StartTFNLookup', [$this->uri, get_class($this), &$profile_id])) {
Event::handle('StartTFNLookup', [$this->uri, get_class($this), &$profile_id]);
if (!is_null($profile_id)) {
// Yes! Avoid creating a new profile
$this->profile_id = $profile_id;
$this->created = $this->modified = common_sql_now();

View File

@ -1209,7 +1209,8 @@ class Ostatus_profile extends Managed_DataObject
if ($object->type == ActivityObject::PERSON) {
// Does any other protocol have this remote entity we're about to add ?
if (!Event::handle('StartTFNLookup', [$oprofile->uri, get_called_class(), &$profile_id])) {
Event::handle('StartTFNLookup', [$oprofile->uri, get_called_class(), &$profile_id]);
if (!is_null($profile_id)) {
$tfn = true; // been here!
// Yes! Avoid creating a new profile