Don't break when notice grabber fails
It's better to fragment the integrity of a note than to fail publishing a note
This commit is contained in:
parent
334923e542
commit
935495415b
@ -108,7 +108,7 @@ class apActorFollowersAction extends ManagedAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a list of followers for a given profile.
|
* Generates a list of stalkers for a given profile.
|
||||||
*
|
*
|
||||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||||
* @param Profile $profile
|
* @param Profile $profile
|
||||||
|
@ -108,7 +108,7 @@ class apActorFollowingAction extends ManagedAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a list of people following given profile.
|
* Generates the list of those a given profile is stalking.
|
||||||
*
|
*
|
||||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||||
* @param Profile $profile
|
* @param Profile $profile
|
||||||
|
@ -188,11 +188,15 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
if (isset($settings['inReplyTo'])) {
|
if (isset($settings['inReplyTo'])) {
|
||||||
try {
|
try {
|
||||||
$inReplyTo = ActivityPubPlugin::grab_notice_from_url($settings['inReplyTo']);
|
$inReplyTo = ActivityPubPlugin::grab_notice_from_url($settings['inReplyTo']);
|
||||||
|
$act->context->replyToID = $inReplyTo->getUri();
|
||||||
|
$act->context->replyToUrl = $inReplyTo->getUrl();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new Exception('Invalid Object inReplyTo value: '.$e->getMessage());
|
// It failed to grab, maybe we got this note from another source
|
||||||
|
// (e.g.: OStatus) that handles this differently or we really
|
||||||
|
// failed to get it...
|
||||||
|
// Welp, nothing that we can do about, let's
|
||||||
|
// just fake we don't have such notice.
|
||||||
}
|
}
|
||||||
$act->context->replyToID = $inReplyTo->getUri();
|
|
||||||
$act->context->replyToUrl = $inReplyTo->getUrl();
|
|
||||||
} else {
|
} else {
|
||||||
$inReplyTo = null;
|
$inReplyTo = null;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ class Activitypub_profile extends Managed_DataObject
|
|||||||
$inboxes = Activitypub_explorer::get_actor_inboxes_uri($url);
|
$inboxes = Activitypub_explorer::get_actor_inboxes_uri($url);
|
||||||
|
|
||||||
if ($inboxes == null) {
|
if ($inboxes == null) {
|
||||||
throw new Exception ('This is not an ActivityPub user thus AProfile is politely refusing to proceed.');
|
throw new Exception('This is not an ActivityPub user thus AProfile is politely refusing to proceed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$aprofile->created = $aprofile->modified = common_sql_now();
|
$aprofile->created = $aprofile->modified = common_sql_now();
|
||||||
|
@ -68,7 +68,7 @@ class Activitypub_postman
|
|||||||
$followers = apActorFollowersAction::generate_followers($this->actor, 0, null);
|
$followers = apActorFollowersAction::generate_followers($this->actor, 0, null);
|
||||||
foreach ($followers as $sub) {
|
foreach ($followers as $sub) {
|
||||||
try {
|
try {
|
||||||
$to[]= Activitypub_profile::from_profile($discovery->lookup($sub)[0]);
|
$to[]= Activitypub_profile::from_profile($discovery->lookup($sub)[0]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Not an ActivityPub Remote Follower, let it go
|
// Not an ActivityPub Remote Follower, let it go
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user