From: Maksim Date: Thu, 29 Aug 2019 11:45:25 +0000 (+0000) Subject: Apply suggestion to lib/pleroma/emoji/loader.ex X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=5c90b7073332ac333a5db9dfc82744cee03843fa;p=akkoma Apply suggestion to lib/pleroma/emoji/loader.ex --- diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index 70eba9ac6..82fc3b8c3 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -122,19 +122,17 @@ defmodule Pleroma.Emoji.Loader do end def find_all_emoji(dir, exts) do - Enum.reduce( - File.ls!(dir), - [], - fn f, acc -> - filepath = Path.join(dir, f) - - if File.dir?(filepath) do - acc ++ find_all_emoji(filepath, exts) - else - acc ++ [filepath] - end + dir + |> File.ls!() + |> Enum.flat_map(fn f -> + filepath = Path.join(dir, f) + + if File.dir?(filepath) do + find_all_emoji(filepath, exts) + else + [filepath] end - ) + end) |> Enum.filter(fn f -> Path.extname(f) in exts end) end