diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index e95a314b4..c3b7bdaee 100644
--- a/lib/pleroma/formatter.ex
+++ b/lib/pleroma/formatter.ex
@@ -23,75 +23,81 @@ defmodule Pleroma.Formatter do
|> Enum.filter(fn ({_match, user}) -> user end)
end
- def finmojifiy(text) do
- emoji_list = [
- "a_trusted_friend",
- "alandislands",
- "association",
- "auroraborealis",
- "baby_in_a_box",
- "bear",
- "black_gold",
- "christmasparty",
- "crosscountryskiing",
- "cupofcoffee",
- "education",
- "fashionista_finns",
- "finnishlove",
- "flag",
- "forest",
- "four_seasons_of_bbq",
- "girlpower",
- "handshake",
- "happiness",
- "headbanger",
- "icebreaker",
- "iceman",
- "joulutorttu",
- "kaamos",
- "kalsarikannit_f",
- "kalsarikannit_m",
- "karjalanpiirakka",
- "kicksled",
- "kokko",
- "lavatanssit",
- "losthopes_f",
- "losthopes_m",
- "mattinykanen",
- "meanwhileinfinland",
- "moominmamma",
- "nordicfamily",
- "out_of_office",
- "peacemaker",
- "perkele",
- "pesapallo",
- "polarbear",
- "pusa_hispida_saimensis",
- "reindeer",
- "sami",
- "sauna_f",
- "sauna_m",
- "sauna_whisk",
- "sisu",
- "stuck",
- "suomimainittu",
- "superfood",
- "swan",
- "the_cap",
- "the_conductor",
- "the_king",
- "the_voice",
- "theoriginalsanta",
- "tomoffinland",
- "torillatavataan",
- "unbreakable",
- "waiting",
- "white_nights",
- "woollysocks"
- ]
+ @finmoji [
+ "a_trusted_friend",
+ "alandislands",
+ "association",
+ "auroraborealis",
+ "baby_in_a_box",
+ "bear",
+ "black_gold",
+ "christmasparty",
+ "crosscountryskiing",
+ "cupofcoffee",
+ "education",
+ "fashionista_finns",
+ "finnishlove",
+ "flag",
+ "forest",
+ "four_seasons_of_bbq",
+ "girlpower",
+ "handshake",
+ "happiness",
+ "headbanger",
+ "icebreaker",
+ "iceman",
+ "joulutorttu",
+ "kaamos",
+ "kalsarikannit_f",
+ "kalsarikannit_m",
+ "karjalanpiirakka",
+ "kicksled",
+ "kokko",
+ "lavatanssit",
+ "losthopes_f",
+ "losthopes_m",
+ "mattinykanen",
+ "meanwhileinfinland",
+ "moominmamma",
+ "nordicfamily",
+ "out_of_office",
+ "peacemaker",
+ "perkele",
+ "pesapallo",
+ "polarbear",
+ "pusa_hispida_saimensis",
+ "reindeer",
+ "sami",
+ "sauna_f",
+ "sauna_m",
+ "sauna_whisk",
+ "sisu",
+ "stuck",
+ "suomimainittu",
+ "superfood",
+ "swan",
+ "the_cap",
+ "the_conductor",
+ "the_king",
+ "the_voice",
+ "theoriginalsanta",
+ "tomoffinland",
+ "torillatavataan",
+ "unbreakable",
+ "waiting",
+ "white_nights",
+ "woollysocks"
+ ]
- Enum.reduce(emoji_list, text, fn (emoji, text) ->
- String.replace(text, ":#{String.replace(emoji, "_", "")}:", "")
+ @finmoji_with_filenames Enum.map(@finmoji, fn (finmoji) ->
+ {finmoji, "/finmoji/128px/#{finmoji}-128.png"}
+ end)
+
+ @emoji @finmoji_with_filenames
+
+ def finmojifiy(text) do
+ Enum.reduce(@emoji, text, fn ({emoji, file}, text) ->
+ String.replace(text, ":#{emoji}:", "")
end)
end
end
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
index 9b6ee2425..4b15f4080 100644
--- a/test/formatter_test.exs
+++ b/test/formatter_test.exs
@@ -47,7 +47,7 @@ defmodule Pleroma.FormatterTest do
test "it adds cool emoji" do
text = "I love :moominmamma:"
- expected_result = "I love "
+ expected_result = "I love "
assert Formatter.finmojifiy(text) == expected_result
end