mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-18 15:41:05 +00:00
Apply suggestion to lib/pleroma/emoji/loader.ex
This commit is contained in:
parent
d7808b5db4
commit
5c90b70733
1 changed files with 9 additions and 11 deletions
|
@ -122,19 +122,17 @@ defmodule Pleroma.Emoji.Loader do
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all_emoji(dir, exts) do
|
def find_all_emoji(dir, exts) do
|
||||||
Enum.reduce(
|
dir
|
||||||
File.ls!(dir),
|
|> File.ls!()
|
||||||
[],
|
|> Enum.flat_map(fn f ->
|
||||||
fn f, acc ->
|
filepath = Path.join(dir, f)
|
||||||
filepath = Path.join(dir, f)
|
|
||||||
|
|
||||||
if File.dir?(filepath) do
|
if File.dir?(filepath) do
|
||||||
acc ++ find_all_emoji(filepath, exts)
|
find_all_emoji(filepath, exts)
|
||||||
else
|
else
|
||||||
acc ++ [filepath]
|
[filepath]
|
||||||
end
|
|
||||||
end
|
end
|
||||||
)
|
end)
|
||||||
|> Enum.filter(fn f -> Path.extname(f) in exts end)
|
|> Enum.filter(fn f -> Path.extname(f) in exts end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue