Damaged limit staff skip (#20)

* Adds ability to enforce limits on staff

* Fix space
This commit is contained in:
SomewhatDamaged 2020-09-24 23:36:39 +10:00 committed by GitHub
parent dd9dc18d8c
commit 70959e9094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) ->