Emoji: Also accept regional indicators
This commit is contained in:
parent
a0aece3223
commit
fa0d0b602f
@ -104,6 +104,11 @@ defmodule Pleroma.Emoji do
|
|||||||
|
|
||||||
@external_resource "lib/pleroma/emoji-test.txt"
|
@external_resource "lib/pleroma/emoji-test.txt"
|
||||||
|
|
||||||
|
regional_indicators =
|
||||||
|
Enum.map(127_462..127_487, fn codepoint ->
|
||||||
|
<<codepoint::utf8>>
|
||||||
|
end)
|
||||||
|
|
||||||
emojis =
|
emojis =
|
||||||
@external_resource
|
@external_resource
|
||||||
|> File.read!()
|
|> File.read!()
|
||||||
@ -125,6 +130,8 @@ defmodule Pleroma.Emoji do
|
|||||||
end)
|
end)
|
||||||
|> Enum.uniq()
|
|> Enum.uniq()
|
||||||
|
|
||||||
|
emojis = emojis ++ regional_indicators
|
||||||
|
|
||||||
for emoji <- emojis do
|
for emoji <- emojis do
|
||||||
def is_unicode_emoji?(unquote(emoji)), do: true
|
def is_unicode_emoji?(unquote(emoji)), do: true
|
||||||
end
|
end
|
||||||
|
@ -20,6 +20,11 @@ defmodule Pleroma.EmojiTest do
|
|||||||
assert Emoji.is_unicode_emoji?("🤰")
|
assert Emoji.is_unicode_emoji?("🤰")
|
||||||
assert Emoji.is_unicode_emoji?("❤️")
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user