@@ -136,6 +136,7 class Repository < ActiveRecord::Base | |||
|
136 | 136 | end |
|
137 | 137 | end |
|
138 | 138 | @committers = nil |
|
139 | @found_committer_users = nil | |
|
139 | 140 | true |
|
140 | 141 | else |
|
141 | 142 | false |
@@ -146,16 +147,22 class Repository < ActiveRecord::Base | |||
|
146 | 147 | # It will return nil if the committer is not yet mapped and if no User |
|
147 | 148 | # with the same username or email was found |
|
148 | 149 | def find_committer_user(committer) |
|
149 |
|
|
|
150 | unless committer.blank? | |
|
151 | @found_committer_users ||= {} | |
|
152 | return @found_committer_users[committer] if @found_committer_users.has_key?(committer) | |
|
153 | ||
|
154 | user = nil | |
|
150 | 155 | c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user) |
|
151 | 156 | if c && c.user |
|
152 | c.user | |
|
157 | user = c.user | |
|
153 | 158 | elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/ |
|
154 | 159 | username, email = $1.strip, $3 |
|
155 | 160 | u = User.find_by_login(username) |
|
156 | 161 | u ||= User.find_by_mail(email) unless email.blank? |
|
157 | u | |
|
162 | user = u | |
|
158 | 163 | end |
|
164 | @found_committer_users[committer] = user | |
|
165 | user | |
|
159 | 166 | end |
|
160 | 167 | end |
|
161 | 168 |
General Comments 0
You need to be logged in to leave comments.
Login now