X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcommon_api%2Fcommon_api.ex;h=0706e7ffcc9ee0306d1bb292a9c0f14a7cc0773e;hb=b923842e96e821afeb7bbfa0d098b9c5698281c5;hp=b02c47059b27698a187332c3f88ae6e120642a15;hpb=71eff09e564ae3eeaf02acecbb8d89b7d4e2e511;p=akkoma diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index b02c47059..0706e7ffc 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -114,6 +114,16 @@ defmodule Pleroma.Web.CommonAPI do end end + def react_with_emoji(id, user, emoji) do + with %Activity{} = activity <- Activity.get_by_id(id), + object <- Object.normalize(activity) do + ActivityPub.react_with_emoji(user, object, emoji) + else + _ -> + {:error, dgettext("errors", "Could not add reaction emoji")} + end + end + def vote(user, %{data: %{"type" => "Question"}} = object, choices) do with :ok <- validate_not_author(object, user), :ok <- validate_existing_votes(user, object), @@ -219,7 +229,8 @@ defmodule Pleroma.Web.CommonAPI do Map.take(data, ["album", "artist", "title", "length"]) |> Map.put("type", "Audio") |> Map.put("to", to) - |> Map.put("cc", cc), + |> Map.put("cc", cc) + |> Map.put("actor", user.ap_id), {:ok, activity} <- ActivityPub.listen(%{ actor: user,