Commit e226551e812faf2264b9747e3123c3ec0d1b9e58
1 parent
51f48392
Exists in
master
and in
4 other branches
Fix hooks for merge request which were accepted by web-interface
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
app/workers/post_receive.rb
... | ... | @@ -6,11 +6,15 @@ class PostReceive |
6 | 6 | return false if project.nil? |
7 | 7 | |
8 | 8 | # Ignore push from non-gitlab users |
9 | - if /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) | |
10 | - return false unless user = User.find_by_email(identifier) | |
9 | + user = if identifier.eql? Gitlab.config.gitolite_admin_key | |
10 | + email = project.commit(newrev).author.email | |
11 | + User.find_by_email(email) | |
12 | + elsif /^[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}$/.match(identifier) | |
13 | + User.find_by_email(identifier) | |
11 | 14 | else |
12 | - return false unless user = Key.find_by_identifier(identifier).try(:user) | |
15 | + Key.find_by_identifier(identifier).try(:user) | |
13 | 16 | end |
17 | + return false unless user | |
14 | 18 | |
15 | 19 | project.trigger_post_receive(oldrev, newrev, ref, user) |
16 | 20 | end | ... | ... |