[ActivityPub] Inbox Handler: Remove old guzzle import

Improve exception information in doc blocks
This commit is contained in:
Diogo Cordeiro 2019-10-11 17:18:29 +01:00 committed by Diogo Peralta Cordeiro
parent 174733edc8
commit 48eee0e018
1 changed files with 21 additions and 12 deletions

View File

@ -70,8 +70,8 @@ class Activitypub_inbox_handler
/** /**
* Validates if a given Activity is valid. Throws exception if not. * Validates if a given Activity is valid. Throws exception if not.
* *
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @throws Exception * @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function validate_activity() private function validate_activity()
{ {
@ -116,6 +116,11 @@ class Activitypub_inbox_handler
/** /**
* Sends the Activity to proper handler in order to be processed. * Sends the Activity to proper handler in order to be processed.
* *
* @throws AlreadyFulfilledException
* @throws HTTP_Request2_Exception
* @throws NoProfileException
* @throws ServerException
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function process() private function process()
@ -168,6 +173,7 @@ class Activitypub_inbox_handler
* @throws HTTP_Request2_Exception * @throws HTTP_Request2_Exception
* @throws NoProfileException * @throws NoProfileException
* @throws ServerException * @throws ServerException
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function handle_accept_follow() private function handle_accept_follow()
@ -202,6 +208,7 @@ class Activitypub_inbox_handler
/** /**
* Handle a Create Note Activity received by our inbox. * Handle a Create Note Activity received by our inbox.
* *
* @throws Exception
* @author Bruno Casteleiro <brunoccast@fc.up.pt> * @author Bruno Casteleiro <brunoccast@fc.up.pt>
*/ */
private function handle_create_note() private function handle_create_note()
@ -216,7 +223,7 @@ class Activitypub_inbox_handler
/** /**
* Handles a Delete Activity received by our inbox. * Handles a Delete Activity received by our inbox.
* *
* @throws AuthorizationException * @throws NoProfileException
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function handle_delete() private function handle_delete()
@ -231,8 +238,8 @@ class Activitypub_inbox_handler
if ($aprofile instanceof Activitypub_profile) { if ($aprofile instanceof Activitypub_profile) {
$this->handle_delete_profile($aprofile); $this->handle_delete_profile($aprofile);
return; return;
} }
// note deletion ? // note deletion ?
try { try {
$notice = ActivityPubPlugin::grab_notice_from_url($object, false); $notice = ActivityPubPlugin::grab_notice_from_url($object, false);
@ -250,12 +257,13 @@ class Activitypub_inbox_handler
/** /**
* Handles a Delete-Profile Activity. * Handles a Delete-Profile Activity.
* *
* Note that the actual ap_profile is deleted during the ProfileDeleteRelated event, * Note that the actual ap_profile is deleted during the ProfileDeleteRelated event,
* subscribed by ActivityPubPlugin. * subscribed by ActivityPubPlugin.
* *
* @param Activitypub_profile $aprofile remote user being deleted * @param Activitypub_profile $aprofile remote user being deleted
* @return void * @return void
* @throws NoProfileException
* @author Bruno Casteleiro <brunoccast@fc.up.pt> * @author Bruno Casteleiro <brunoccast@fc.up.pt>
*/ */
private function handle_delete_profile(Activitypub_profile $aprofile): void private function handle_delete_profile(Activitypub_profile $aprofile): void
@ -266,9 +274,10 @@ class Activitypub_inbox_handler
/** /**
* Handles a Delete-Note Activity. * Handles a Delete-Note Activity.
* *
* @param Notice $note remote note being deleted * @param Notice $note remote note being deleted
* @return void * @return void
* @throws AuthorizationException
* @author Bruno Casteleiro <brunoccast@fc.up.pt> * @author Bruno Casteleiro <brunoccast@fc.up.pt>
*/ */
private function handle_delete_note(Notice $note): void private function handle_delete_note(Notice $note): void
@ -283,8 +292,6 @@ class Activitypub_inbox_handler
* @throws HTTP_Request2_Exception * @throws HTTP_Request2_Exception
* @throws NoProfileException * @throws NoProfileException
* @throws ServerException * @throws ServerException
* @throws \GuzzleHttp\Exception\GuzzleException
* @throws \HttpSignatures\Exception
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function handle_follow() private function handle_follow()
@ -332,6 +339,7 @@ class Activitypub_inbox_handler
* @throws HTTP_Request2_Exception * @throws HTTP_Request2_Exception
* @throws NoProfileException * @throws NoProfileException
* @throws ServerException * @throws ServerException
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function handle_undo_follow() private function handle_undo_follow()
@ -344,9 +352,9 @@ class Activitypub_inbox_handler
Subscription::cancel($this->actor, $object_profile); Subscription::cancel($this->actor, $object_profile);
// You are no longer following this person. // You are no longer following this person.
Activitypub_profile::unsubscribeCacheUpdate($this->actor, $object_profile); Activitypub_profile::unsubscribeCacheUpdate($this->actor, $object_profile);
} else { } /*else {
// 409: You are not following this person already. // 409: You already aren't following this person.
} }*/
} }
/** /**
@ -354,6 +362,7 @@ class Activitypub_inbox_handler
* *
* @throws AlreadyFulfilledException * @throws AlreadyFulfilledException
* @throws ServerException * @throws ServerException
* @throws Exception
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
*/ */
private function handle_undo_like() private function handle_undo_like()