FIX: post deletions rate limit per day was not working

This commit is contained in:
Arpit Jalan 2018-06-28 19:21:27 +05:30
parent 9f4e814dbc
commit 2c971c41f6
1 changed files with 6 additions and 3 deletions

View File

@ -267,8 +267,8 @@ class PostsController < ApplicationController
def destroy
post = find_post_from_params
unless current_user.staff?
RateLimiter.new(current_user, "delete_post", SiteSetting.max_post_deletions_per_minute, 1.minute).performed!
RateLimiter.new(current_user, "delete_post", SiteSetting.max_post_deletions_per_day, 1.day).performed!
RateLimiter.new(current_user, "delete_post_per_min", SiteSetting.max_post_deletions_per_minute, 1.minute).performed!
RateLimiter.new(current_user, "delete_post_per_day", SiteSetting.max_post_deletions_per_day, 1.day).performed!
end
guardian.ensure_can_delete!(post)
@ -287,7 +287,10 @@ class PostsController < ApplicationController
def recover
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_per_min", SiteSetting.max_post_deletions_per_minute, 1.minute).performed!
RateLimiter.new(current_user, "delete_post_per_day", SiteSetting.max_post_deletions_per_day, 1.day).performed!
end
guardian.ensure_can_recover_post!(post)
destroyer = PostDestroyer.new(current_user, post)
destroyer.recover