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>
Sun, 15 Mar 2020 21:15:21 +0000 (00:15 +0300)
commitc46d035f7bc79f451c8b2356f3b809c29684cfe4
treeecc6d19a0807345e3b6699333a43a6f7f6c95e28
parent9d0975529182a1f9002ed8ccd7aa94d058ef83f7
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