ActivityPub: Use is_unicode_emoji? function.
This commit is contained in:
parent
a697f0d791
commit
e5b3ad3d04
3 changed files with 1 additions and 6 deletions
|
@ -315,7 +315,7 @@ def update(%{to: to, cc: cc, actor: actor, object: object} = params) 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
|
||||
|
|
|
@ -277,10 +277,6 @@ def get_object_likes(%{data: %{"id" => id}}) 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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue