CommonAPI: Add unreactions.

This commit is contained in:
lain 2019-10-02 15:38:57 +02:00
commit 9cfe9a57c5
3 changed files with 26 additions and 1 deletions

View file

@ -125,6 +125,15 @@ defmodule Pleroma.Web.CommonAPI do
end
end
def unreact_with_emoji(id, user, emoji) do
with %Activity{} = reaction_activity <- Utils.get_latest_reaction(id, user, emoji) do
ActivityPub.unreact_with_emoji(user, reaction_activity.data["id"])
else
_ ->
{:error, dgettext("errors", "Could not remove 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),