FEATURE: new settings to control posts deletions rate limit
This commit is contained in:
parent
c352f8eb15
commit
a6d50d1ff7
|
@ -267,8 +267,8 @@ class PostsController < ApplicationController
|
|||
def destroy
|
||||
post = find_post_from_params
|
||||
unless current_user.staff?
|
||||
RateLimiter.new(current_user, "delete_post", 3, 1.minute).performed!
|
||||
RateLimiter.new(current_user, "delete_post", 50, 1.day).performed!
|
||||
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!
|
||||
end
|
||||
|
||||
guardian.ensure_can_delete!(post)
|
||||
|
|
|
@ -1312,6 +1312,9 @@ en:
|
|||
max_logins_per_ip_per_hour: "Maximum number of logins allowed per IP address per hour"
|
||||
max_logins_per_ip_per_minute: "Maximum number of logins allowed per IP address per minute"
|
||||
|
||||
max_post_deletions_per_minute: "Maximum number of posts a user can delete per minute."
|
||||
max_post_deletions_per_day: "Maximum number of posts a user can delete per day."
|
||||
|
||||
alert_admins_if_errors_per_minute: "Number of errors per minute in order to trigger an admin alert. A value of 0 disables this feature. NOTE: requires restart."
|
||||
alert_admins_if_errors_per_hour: "Number of errors per hour in order to trigger an admin alert. A value of 0 disables this feature. NOTE: requires restart."
|
||||
|
||||
|
@ -2211,7 +2214,7 @@ en:
|
|||
subject_template: "Thanks for spending time with us"
|
||||
text_body_template: |
|
||||
Hey there. We see you’ve been busy reading, which is fantastic, so we’ve promoted you up a [trust level!](https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/)
|
||||
|
||||
|
||||
We’re really glad you’re spending time with us and we’d love to know more about you. Take a moment to [fill out your profile](/my/preferences/profile), or feel free to [start a new topic](/categories).
|
||||
|
||||
welcome_invite:
|
||||
|
|
|
@ -1187,6 +1187,12 @@ rate_limits:
|
|||
max_logins_per_ip_per_minute:
|
||||
min: 1
|
||||
default: 6
|
||||
max_post_deletions_per_minute:
|
||||
min: 1
|
||||
default: 3
|
||||
max_post_deletions_per_day:
|
||||
min: 1
|
||||
default: 50
|
||||
|
||||
developer:
|
||||
force_hostname:
|
||||
|
|
Loading…
Reference in New Issue