diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-06-20 10:56:28 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-06-20 10:56:28 +0300 |
commit | 1a704e1f1e0acb73cbfb49acc4f614dd01799c46 (patch) | |
tree | 659b0bc49b4501d12d7b99c185522d50d07af30e /lib | |
parent | 02ca8a363f738ece7b605940690f6a538f6c2fa8 (diff) | |
download | pleroma-1a704e1f1e0acb73cbfb49acc4f614dd01799c46.tar.gz pleroma-1a704e1f1e0acb73cbfb49acc4f614dd01799c46.zip |
fix for packs pagination
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/emoji/pack.ex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/emoji/pack.ex b/lib/pleroma/emoji/pack.ex index 2dca21c93..787ff8141 100644 --- a/lib/pleroma/emoji/pack.ex +++ b/lib/pleroma/emoji/pack.ex @@ -32,8 +32,8 @@ defmodule Pleroma.Emoji.Pack do defp paginate(entities, page, page_size) do entities - |> Enum.take(page * page_size) - |> Enum.take(-page_size) + |> Enum.chunk_every(page_size) + |> Enum.at(page - 1) end @spec show(keyword()) :: {:ok, t()} | {:error, atom()} @@ -470,7 +470,7 @@ defmodule Pleroma.Emoji.Pack do # with the API so it should be sufficient with {:create_dir, :ok} <- {:create_dir, File.mkdir_p(emoji_path)}, {:ls, {:ok, results}} <- {:ls, File.ls(emoji_path)} do - {:ok, results} + {:ok, Enum.sort(results)} else {:create_dir, {:error, e}} -> {:error, :create_dir, e} {:ls, {:error, e}} -> {:error, :ls, e} |