mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:14:58 +08:00
SECURITY: verify that inviter can invite new user to a topic
This commit is contained in:
@ -138,7 +138,7 @@ class Invite < ActiveRecord::Base
|
||||
invite.invited_groups.create!(group_id: group_id)
|
||||
end
|
||||
else
|
||||
if topic && topic.category # && Guardian.new(invited_by).can_invite_to?(topic)
|
||||
if topic && topic.category && Guardian.new(invited_by).can_invite_to?(topic)
|
||||
group_ids = topic.category.groups.pluck(:id) - invite.invited_groups.pluck(:group_id)
|
||||
group_ids.each { |group_id| invite.invited_groups.create!(group_id: group_id) }
|
||||
end
|
||||
|
Reference in New Issue
Block a user