import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations
@primary_key false
- @emoji_regex ~r/:[A-Za-z0-9_-]+(@.+)?:/
embedded_schema do
quote do
end
end
- defp matches_shortcode?(nil), do: false
- defp matches_shortcode?(s), do: Regex.match?(@emoji_regex, s)
-
defp fix_emoji_qualification(%{"content" => emoji} = data) do
new_emoji = Pleroma.Emoji.fully_qualify_emoji(emoji)
defp validate_emoji(cng) do
content = get_field(cng, :content)
- if Emoji.is_unicode_emoji?(content) || matches_shortcode?(content) do
+ if Emoji.is_unicode_emoji?(content) || Emoji.matches_shortcode?(content) do
cng
else
cng