From 70959e9094c0c11d6898212824863fe1eda6be4c Mon Sep 17 00:00:00 2001 From: SomewhatDamaged Date: Thu, 24 Sep 2020 23:36:39 +1000 Subject: [PATCH] Damaged limit staff skip (#20) * Adds ability to enforce limits on staff * Fix space --- lib/philomena_web/plugs/limit_plug.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/philomena_web/plugs/limit_plug.ex b/lib/philomena_web/plugs/limit_plug.ex index 2e8ea0c8..e572cb60 100644 --- a/lib/philomena_web/plugs/limit_plug.ex +++ b/lib/philomena_web/plugs/limit_plug.ex @@ -22,6 +22,7 @@ defmodule PhilomenaWeb.LimitPlug do limit = Keyword.get(opts, :limit, 1) time = Keyword.get(opts, :time, 5) error = Keyword.get(opts, :error) + skip_staff = Keyword.get(opts, :skip_staff, true) data = [ current_user_id(conn.assigns.current_user), @@ -39,7 +40,7 @@ defmodule PhilomenaWeb.LimitPlug do amt <= limit -> conn - is_staff(conn.assigns.current_user) -> + is_staff(conn.assigns.current_user) and skip_staff -> conn ajax?(conn) ->