From: lain Date: Thu, 3 Dec 2020 15:17:39 +0000 (+0100) Subject: Emoji: Also accept regional indicators X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=fa0d0b602f10a3671ff00151028990c57d8ab447;p=akkoma Emoji: Also accept regional indicators --- diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex index 201212779..513fb59f8 100644 --- a/lib/pleroma/emoji.ex +++ b/lib/pleroma/emoji.ex @@ -104,6 +104,11 @@ defmodule Pleroma.Emoji do @external_resource "lib/pleroma/emoji-test.txt" + regional_indicators = + Enum.map(127_462..127_487, fn codepoint -> + <> + end) + emojis = @external_resource |> File.read!() @@ -125,6 +130,8 @@ defmodule Pleroma.Emoji do end) |> Enum.uniq() + emojis = emojis ++ regional_indicators + for emoji <- emojis do def is_unicode_emoji?(unquote(emoji)), do: true end diff --git a/test/pleroma/emoji_test.exs b/test/pleroma/emoji_test.exs index 97af25280..9cfd7b46b 100644 --- a/test/pleroma/emoji_test.exs +++ b/test/pleroma/emoji_test.exs @@ -20,6 +20,11 @@ defmodule Pleroma.EmojiTest do assert Emoji.is_unicode_emoji?("🤰") assert Emoji.is_unicode_emoji?("❤️") assert Emoji.is_unicode_emoji?("🏳️‍⚧️") + + # Additionally, we accept regional indicators. + assert Emoji.is_unicode_emoji?("🇵") + assert Emoji.is_unicode_emoji?("🇴") + assert Emoji.is_unicode_emoji?("🇬") end end