# HG changeset patch # User Chris Cannam # Date 1423664360 0 # Node ID b31caaed9d4d3b414e063d117ac00f0efd37daff # Parent 83a2227efc710fa3c2e5eafeb320802f0ecf7454# Parent 59e13100ea954af01cda56aab9bcbdf09b086751 Look up users by name as well as email/login: for use with #1136 diff -r 83a2227efc71 -r b31caaed9d4d app/models/repository.rb --- a/app/models/repository.rb Wed Oct 08 14:04:32 2014 +0100 +++ b/app/models/repository.rb Wed Feb 11 14:19:20 2015 +0000 @@ -321,7 +321,21 @@ elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/ username, email = $1.strip, $3 u = User.find_by_login(username) - u ||= User.find_by_mail(email) unless email.blank? + if u.nil? + if email.blank? + if username.strip =~ /^([^ ]+) ([^ ]+)$/ + first, last = $1, $2 + uu = User.where(:firstname => first, :lastname => last) + if uu.length == 1 + u = uu.first + else + logger.warn "find_committer_user: found more than one (#{uu.length}) results for user named #{username}, ignoring" + end + end + else + u = User.find_by_mail(email) + end + end user = u end @found_committer_users[committer] = user