[TheFreeNetwork] Do not allow lower priority protocols to handle remote actors already handled by the higher ones

This commit is contained in:
Diogo Cordeiro
2020-08-26 23:55:36 +01:00
committed by Diogo Peralta Cordeiro
parent a0a37352c8
commit c834d27dd6
7 changed files with 66 additions and 12 deletions

View File

@@ -285,8 +285,6 @@ class Activitypub_profile extends Managed_DataObject
}
$aprofile->created = $aprofile->modified = common_sql_now();
$aprofile = new Activitypub_profile;
$aprofile->profile_id = $profile->getID();
$aprofile->uri = $url;
$aprofile->nickname = $profile->getNickname();

View File

@@ -49,7 +49,7 @@ class Activitypub_postman
* Create a postman to deliver something to someone
*
* @param Profile $from sender Profile
* @param array $to receiver Profiles
* @param array $to receiver AProfiles
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt>
*/

View File

@@ -287,7 +287,13 @@ class SalmonAction extends Action
if (!$this->oprofile instanceof Ostatus_profile) {
common_debug("We do not have a local profile to connect to this activity's author. Let's create one.");
// ensureActivityObjectProfile throws exception on failure
$this->oprofile = Ostatus_profile::ensureActivityObjectProfile($this->activity->actor);
try {
$this->oprofile = Ostatus_profile::ensureActivityObjectProfile($this->activity->actor);
} catch (AlreadyHandledException $e) {
// Some other federation protocol is handling this profile, let it go.
common_debug('SalmonAction found that this actor already was handled by another federation protocol: ' . $e->getMessage());
return;
}
}
}