scm: code clean up app/models/changeset.rb.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5372 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-04-09 09:30:50 +00:00
parent c12453ec4e
commit b9ce061319
1 changed files with 13 additions and 9 deletions

View File

@ -81,7 +81,8 @@ class Changeset < ActiveRecord::Base
def before_create
self.committer = self.class.to_utf8(self.committer, repository.repo_log_encoding)
self.comments = self.class.normalize_comments(self.comments, repository.repo_log_encoding)
self.comments = self.class.normalize_comments(
self.comments, repository.repo_log_encoding)
self.user = repository.find_committer_user(self.committer)
end
@ -174,7 +175,9 @@ class Changeset < ActiveRecord::Base
return nil if id.blank?
issue = Issue.find_by_id(id.to_i, :include => :project)
if issue
unless issue.project && (project == issue.project || project.is_ancestor_of?(issue.project) || project.is_descendant_of?(issue.project))
unless issue.project &&
(project == issue.project || project.is_ancestor_of?(issue.project) ||
project.is_descendant_of?(issue.project))
issue = nil
end
end
@ -212,7 +215,8 @@ class Changeset < ActiveRecord::Base
:hours => hours,
:issue => issue,
:spent_on => commit_date,
:comments => l(:text_time_logged_by_changeset, :value => text_tag, :locale => Setting.default_language)
:comments => l(:text_time_logged_by_changeset, :value => text_tag,
:locale => Setting.default_language)
)
time_entry.activity = log_time_activity unless log_time_activity.nil?