mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
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:
@ -368,7 +368,15 @@ class GroupsController < ApplicationController
|
||||
end
|
||||
|
||||
emails.each do |email|
|
||||
Invite.generate(current_user, email: email, group_ids: [group.id])
|
||||
begin
|
||||
Invite.generate(current_user, email: email, group_ids: [group.id])
|
||||
rescue RateLimiter::LimitExceeded => e
|
||||
return render_json_error(I18n.t(
|
||||
"invite.rate_limit",
|
||||
count: SiteSetting.max_invites_per_day,
|
||||
time_left: e.time_left
|
||||
))
|
||||
end
|
||||
end
|
||||
|
||||
render json: success_json.merge!(
|
||||
|
Reference in New Issue
Block a user