rate limiter: disable based on if remote ip was found, not on if the plug was enabled
authorrinpatch <rinpatch@sdf.org>
Fri, 13 Mar 2020 18:15:42 +0000 (21:15 +0300)
committerrinpatch <rinpatch@sdf.org>
Fri, 13 Mar 2020 18:41:17 +0000 (21:41 +0300)
commitfc4496d4fa45b0389f8476b2c2ee00d647a1dfbe
treec917ced57828d225ea898ebe26c1d4b0e8205826
parent00d17520314e3591caaa7ab4ca39c6227a6bdf15
rate limiter: disable based on if remote ip was found, not on if the plug was enabled

The current rate limiter disable logic won't trigger when the remote ip
is not forwarded, only when the remoteip plug is not enabled, which is
not the case on most instances since it's enabled by default. This
changes the behavior to warn and disable  when the remote ip was not forwarded,
even if the RemoteIP plug is enabled.

Also closes #1620
config/test.exs
lib/pleroma/plugs/rate_limiter/rate_limiter.ex
lib/pleroma/plugs/remote_ip.ex
test/plugs/rate_limiter_test.exs
test/web/mastodon_api/controllers/account_controller_test.exs