FIX: Allow add email to group if user can invite (#13097)

It used to allow adding email addresses to a group even if invites were
disabled for the site. This does not allow user to input email address
if they cannot invite.

The second thing this commit improves is the message that is displayed
to the user when they hit the invite rate limit.
This commit is contained in:
Bianca Nenciu
2021-05-21 11:34:17 +03:00
committed by GitHub
parent 4ce854f21c
commit 38af28d58b
5 changed files with 29 additions and 8 deletions

View File

@@ -11,8 +11,8 @@ class RateLimiter
@type = type
end
def description
time_left =
def time_left
@time_left ||=
if @available_in <= 3
I18n.t("rate_limiter.short_time")
elsif @available_in < 1.minute.to_i
@@ -22,7 +22,9 @@ class RateLimiter
else
I18n.t("rate_limiter.hours", count: (@available_in / 1.hour.to_i))
end
end
def description
if @type.present?
type_key = @type.tr("-", "_")
msg = I18n.t("rate_limiter.by_type.#{type_key}", time_left: time_left, default: "")