Commit f87e887d authored by Nick Thomas's avatar Nick Thomas

Fix Approvable#number_of_potential_approvers for a nil author

parent 51ed5c99
...@@ -50,11 +50,13 @@ module Approvable ...@@ -50,11 +50,13 @@ module Approvable
wheres << "id IN (#{project.group.members.where(has_access).select(:user_id).to_sql})" wheres << "id IN (#{project.group.members.where(has_access).select(:user_id).to_sql})"
end end
User. users = User.
active. active.
where("(#{wheres.join(' OR ')}) AND id NOT IN (#{approvals.select(:user_id).to_sql})"). where("(#{wheres.join(' OR ')}) AND id NOT IN (#{approvals.select(:user_id).to_sql})")
where.not(id: author.id).
count users = users.where.not(id: author.id) if author
users.count
end end
# Users in the list of approvers who have not already approved this MR. # Users in the list of approvers who have not already approved this MR.
......
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