Proper Undo Like

This commit is contained in:
Diogo Cordeiro 2018-08-01 00:42:13 +01:00
parent be1aadcd4c
commit 5196edafa0
3 changed files with 9 additions and 11 deletions

View File

@ -44,15 +44,13 @@ case "Like":
Fave::removeEntry($actor_profile, ActivityPubPlugin::get_local_notice_from_url($data->object->object->id)); Fave::removeEntry($actor_profile, ActivityPubPlugin::get_local_notice_from_url($data->object->object->id));
// Notice disfavorited successfully. // Notice disfavorited successfully.
ActivityPubReturn::answer( ActivityPubReturn::answer(
Activitypub_undo::undo_to_array( Activitypub_undo::undo_to_array(
Activitypub_like::like_to_array( Activitypub_like::like_to_array(
Activitypub_notice::notice_to_array( $actor_profile->getUrl(),
$actor_profile->getUrl(), $data->object->object
$data->object->object )
)
)
) )
); );
} catch (Exception $e) { } catch (Exception $e) {
ActivityPubReturn::error($e->getMessage(), 403); ActivityPubReturn::error($e->getMessage(), 403);
} }

View File

@ -44,8 +44,8 @@ class Activitypub_like extends Managed_DataObject
* Generates an ActivityPub representation of a Like * Generates an ActivityPub representation of a Like
* *
* @author Diogo Cordeiro <diogo@fc.up.pt> * @author Diogo Cordeiro <diogo@fc.up.pt>
* @param string $actor * @param string $actor Actor URI
* @param array $object * @param string $object Notice URI
* @return pretty array to be used in a response * @return pretty array to be used in a response
*/ */
public static function like_to_array($actor, $object) public static function like_to_array($actor, $object)

View File

@ -184,7 +184,7 @@ class Activitypub_postman
$data = Activitypub_undo::undo_to_array( $data = Activitypub_undo::undo_to_array(
Activitypub_like::like_to_array( Activitypub_like::like_to_array(
ActivityPubPlugin::actor_uri($this->actor), ActivityPubPlugin::actor_uri($this->actor),
Activitypub_notice::notice_to_array($notice) $notice->getUrl()
) )
); );
$data = json_encode($data); $data = json_encode($data);