Bug: Merge Request listed as "Approved" when user is a member of approval group

Summary

There is a bug in the existing approval rules code where an MR becomes "Approved" only if the author is a member of approval group. This approval ignores total approvals_required and ignores Prevent approval of merge requests by merge request author setting as well.

Steps to reproduce

  1. Create Merge Request Approval project rule containing author
  2. Submit an MR by author
  3. See Merge request approved without any approvals having been submitted

Example Project

https://gitlab.com/theoretick/approver_tests/merge_requests/8

What is the current bug behavior?

Merge Requests do not require approval if the author is an approver, regardless of approvals_required count

What is the expected correct behavior?

Merge requests should not display Merge Request Approved unless approvals have been submitted

Relevant logs and/or screenshots

Image_2019-06-13_at_16.25.57

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:env:info)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)