ActivityPub: Use is_unicode_emoji? function.

This commit is contained in:
lain 2019-09-13 16:06:34 +02:00
parent a697f0d791
commit e5b3ad3d04
3 changed files with 1 additions and 6 deletions

View File

@ -315,7 +315,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
def react_with_emoji(user, object, emoji, options \\ []) do
with local <- Keyword.get(options, :local, true),
activity_id <- Keyword.get(options, :activity_id, nil),
is_emoji?(emoji),
Pleroma.Emoji.is_unicode_emoji?(emoji),
reaction_data <- make_emoji_reaction_data(user, object, emoji, activity_id),
{:ok, activity} <- insert(reaction_data, local),
{:ok, object} <- add_emoji_reaction_to_object(activity, object) do

View File

@ -277,10 +277,6 @@ defmodule Pleroma.Web.ActivityPub.Utils do
|> Repo.all()
end
def is_emoji?(emoji) do
String.length(emoji) == 1
end
def make_emoji_reaction_data(user, object, emoji, activity_id) do
make_like_data(user, object, activity_id)
|> Map.put("type", "EmojiReaction")

View File

@ -8,7 +8,6 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
alias Pleroma.Conversation.Participation
alias Pleroma.Repo
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.MastodonAPI.AccountView
import Pleroma.Factory