Commit 3d078a9d authored by Douwe Maan's avatar Douwe Maan

Prevent sending an access request to a project from failing when the project has invited members

parent fd85f14c
...@@ -55,7 +55,7 @@ class Member < ActiveRecord::Base ...@@ -55,7 +55,7 @@ class Member < ActiveRecord::Base
scope :active_without_invites, -> do scope :active_without_invites, -> do
left_join_users left_join_users
.where(users: { state: 'active' }) .where(users: { state: 'active' })
.where(requested_at: nil) .non_request
.reorder(nil) .reorder(nil)
end end
......
...@@ -208,9 +208,9 @@ class NotificationService ...@@ -208,9 +208,9 @@ class NotificationService
def new_access_request(member) def new_access_request(member)
return true unless member.notifiable?(:subscription) return true unless member.notifiable?(:subscription)
recipients = member.source.members.owners_and_masters recipients = member.source.members.active_without_invites.owners_and_masters
if fallback_to_group_owners_masters?(recipients, member) if fallback_to_group_owners_masters?(recipients, member)
recipients = member.source.group.members.owners_and_masters recipients = member.source.group.members.active_without_invites.owners_and_masters
end end
recipients.each { |recipient| deliver_access_request_email(recipient, member) } recipients.each { |recipient| deliver_access_request_email(recipient, member) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment