diff options
author | sxsdv1 <sxsdv1@gmail.com> | 2019-01-08 19:22:26 +0100 |
---|---|---|
committer | sxsdv1 <sxsdv1@gmail.com> | 2019-01-12 20:24:35 +0100 |
commit | 36711e1c83bb24a2b104c4a8f384c475c1583638 (patch) | |
tree | 295d9db6151b437f5d2739938fb9415816e08644 /lib | |
parent | 1eb7318831e7239ec929457f6298fb05cb461b43 (diff) | |
download | pleroma-36711e1c83bb24a2b104c4a8f384c475c1583638.tar.gz pleroma-36711e1c83bb24a2b104c4a8f384c475c1583638.zip |
Handle client submitted activitypub like activity
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub_controller.ex | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 73ca07e84..6bc8b7195 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -204,6 +204,15 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do end end + def handle_user_activity(user, %{"type" => "Like"} = params) do + with %Object{} = object <- Object.normalize(params["object"]), + {:ok, activity, _object} <- ActivityPub.like(user, object) do + {:ok, activity} + else + _ -> {:error, "Can't like object"} + end + end + def handle_user_activity(_, _) do {:error, "Unhandled activity type"} end |