summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2016-11-23 12:45:11 +0000
committerSean McGivern <sean@mcgivern.me.uk>2016-11-23 12:45:11 +0000
commit1a45de3d4559a2f92e099a43490e9c50fe4bc86e (patch)
tree47200f6975e8604f62cb69e742e83789c2822370
parentba0d4877934349603e24125864c3a46eba271e0e (diff)
parentb9176afbc887b2bac4e07fdad65f3560cc3ceedf (diff)
downloadgitlab-ce-1a45de3d4559a2f92e099a43490e9c50fe4bc86e.tar.gz
Merge branch 'post_receive-any-email' into 'master'
post_receive: accept any user email from last commit See merge request !7225
-rw-r--r--changelogs/unreleased/post_receive-any-email.yml4
-rw-r--r--lib/gitlab/identifier.rb2
-rw-r--r--spec/lib/gitlab/identifier_spec.rb2
3 files changed, 6 insertions, 2 deletions
diff --git a/changelogs/unreleased/post_receive-any-email.yml b/changelogs/unreleased/post_receive-any-email.yml
new file mode 100644
index 00000000000..3710b1b4b46
--- /dev/null
+++ b/changelogs/unreleased/post_receive-any-email.yml
@@ -0,0 +1,4 @@
+---
+title: "post_receive: accept any user email from last commit"
+merge_request: 7225
+author: Elan Ruusamäe
diff --git a/lib/gitlab/identifier.rb b/lib/gitlab/identifier.rb
index f8809db21aa..c5acf18beb5 100644
--- a/lib/gitlab/identifier.rb
+++ b/lib/gitlab/identifier.rb
@@ -24,7 +24,7 @@ module Gitlab
email = commit.author_email
identify_with_cache(:email, email) do
- User.find_by(email: email)
+ User.find_by_any_email(email)
end
end
diff --git a/spec/lib/gitlab/identifier_spec.rb b/spec/lib/gitlab/identifier_spec.rb
index 47d6f1007d1..f42c4453dd1 100644
--- a/spec/lib/gitlab/identifier_spec.rb
+++ b/spec/lib/gitlab/identifier_spec.rb
@@ -65,7 +65,7 @@ describe Gitlab::Identifier do
commit = double(:commit, author_email: user.email)
expect(project).to receive(:commit).with('123').twice.and_return(commit)
- expect(User).to receive(:find_by).once.and_call_original
+ expect(User).to receive(:find_by_any_email).once.and_call_original
2.times do
expect(identifier.identify_using_commit(project, '123')).to eq(user)