FEATURE: rate limit post deletions to 50 per day

This commit is contained in:
Arpit Jalan 2018-06-28 16:38:58 +05:30
parent 4ca09599af
commit c352f8eb15
1 changed files with 4 additions and 1 deletions

View File

@ -266,7 +266,10 @@ class PostsController < ApplicationController
def destroy
post = find_post_from_params
RateLimiter.new(current_user, "delete_post", 3, 1.minute).performed! unless current_user.staff?
unless current_user.staff?
RateLimiter.new(current_user, "delete_post", 3, 1.minute).performed!
RateLimiter.new(current_user, "delete_post", 50, 1.day).performed!
end
guardian.ensure_can_delete!(post)