Commit 72c9b8a9 authored by Mark Chao's avatar Mark Chao

Refactor approver query

Utilze the new group_users association
parent 2c1c67a0
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
module ApprovalRuleLike module ApprovalRuleLike
extend ActiveSupport::Concern extend ActiveSupport::Concern
include Gitlab::Utils::StrongMemoize
DEFAULT_NAME = 'Default' DEFAULT_NAME = 'Default'
...@@ -17,14 +16,7 @@ module ApprovalRuleLike ...@@ -17,14 +16,7 @@ module ApprovalRuleLike
# Users who are eligible to approve, including specified group members. # Users who are eligible to approve, including specified group members.
# @return [Array<User>] # @return [Array<User>]
def approvers def approvers
strong_memoize(:approvers) do @approvers ||= User.from_union([users, group_users])
User.from_union(
[
users,
User.joins(:group_members).where(members: { source_id: groups })
]
)
end
end end
def add_member(member) def add_member(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