mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:07:30 +08:00
FEATURE: allow for notification of up to 20 group owners (#13081)
The 5 limit appears to be too low. Limiting to 20 group owners, though high seems like a fairer limit. Also... spec cleanup
This commit is contained in:
@ -480,6 +480,8 @@ class GroupsController < ApplicationController
|
||||
)
|
||||
end
|
||||
|
||||
MAX_NOTIFIED_OWNERS ||= 20
|
||||
|
||||
def request_membership
|
||||
params.require(:reason)
|
||||
|
||||
@ -487,14 +489,14 @@ class GroupsController < ApplicationController
|
||||
|
||||
begin
|
||||
GroupRequest.create!(group: group, user: current_user, reason: params[:reason])
|
||||
rescue ActiveRecord::RecordNotUnique => e
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
return render json: failed_json.merge(error: I18n.t("groups.errors.already_requested_membership")), status: 409
|
||||
end
|
||||
|
||||
usernames = [current_user.username].concat(
|
||||
group.users.where('group_users.owner')
|
||||
.order("users.last_seen_at DESC")
|
||||
.limit(5)
|
||||
.limit(MAX_NOTIFIED_OWNERS)
|
||||
.pluck("users.username")
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user