FEATURE: Add rejection message on rejected IncomingEmail

FIX: Better RateLimit description in rejected IncomingEmail
FEATURE: Send email when hitting a rate limit
This commit is contained in:
Régis Hanol
2016-03-07 16:56:17 +01:00
parent 090a064c41
commit 622d804d46
10 changed files with 56 additions and 13 deletions

View File

@@ -9,7 +9,6 @@ class RateLimiter
end
def description
time_left = ""
if @available_in < 1.minute.to_i
time_left = I18n.t("rate_limiter.seconds", count: @available_in)
@@ -20,7 +19,7 @@ class RateLimiter
end
if @type.present?
type_key = @type.gsub(/-/, '_')
type_key = @type.tr("-", "_")
msg = I18n.t("rate_limiter.by_type.#{type_key}", time_left: time_left, default: "")
return msg if msg.present?
end