Browse Source

Memorize commit authors to speed up changesets loading.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3472 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/1.0.0
Jean-Philippe Lang 14 years ago
parent
commit
3d393a5711
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      app/models/repository.rb

+ 10
- 3
app/models/repository.rb View File

@@ -136,6 +136,7 @@ class Repository < ActiveRecord::Base
end
end
@committers = nil
@found_committer_users = nil
true
else
false
@@ -146,16 +147,22 @@ class Repository < ActiveRecord::Base
# It will return nil if the committer is not yet mapped and if no User
# with the same username or email was found
def find_committer_user(committer)
if committer
unless committer.blank?
@found_committer_users ||= {}
return @found_committer_users[committer] if @found_committer_users.has_key?(committer)
user = nil
c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user)
if c && c.user
c.user
user = c.user
elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
username, email = $1.strip, $3
u = User.find_by_login(username)
u ||= User.find_by_mail(email) unless email.blank?
u
user = u
end
@found_committer_users[committer] = user
user
end
end

Loading…
Cancel
Save