diff options
Diffstat (limited to 'app/models/member.rb')
-rw-r--r-- | app/models/member.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/member.rb b/app/models/member.rb index 45af34a3e6b..7e0b4705217 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -50,6 +50,11 @@ class Member < ApplicationRecord }, if: :project_bot? + scope :with_invited_user_state, -> do + joins('LEFT JOIN users as invited_user ON invited_user.email = members.invite_email') + .select('members.*', 'invited_user.state as invited_user_state') + end + scope :in_hierarchy, ->(source) do groups = source.root_ancestor.self_and_descendants group_members = Member.default_scoped.where(source: groups) |