diff options
author | lain <lain@soykaf.club> | 2019-08-27 17:56:28 -0500 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-08-27 17:56:28 -0500 |
commit | b770ed1d9940230d4bd97113abdc220ca7d8eb1a (patch) | |
tree | fce2be56d6a3f8941f60f26f98d19fd52d982049 /lib/pleroma/web/common_api/common_api.ex | |
parent | f017260cdc90d37c1878d7f2f29263dca017ebeb (diff) | |
download | pleroma-b770ed1d9940230d4bd97113abdc220ca7d8eb1a.tar.gz |
CommonAPI: Support emoji reactions.
Diffstat (limited to 'lib/pleroma/web/common_api/common_api.ex')
-rw-r--r-- | lib/pleroma/web/common_api/common_api.ex | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 5faddc9f4..3e1aa4818 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -123,6 +123,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, object, choices) do with "Question" <- object.data["type"], {:author, false} <- {:author, object.data["actor"] == user.ap_id}, |