[refs #579] fixed bug with updating comments

This commit is contained in:
Alexander Machehin 2012-10-18 23:37:52 +06:00
parent ecf8e7e5ee
commit ea1ec80d29
1 changed files with 2 additions and 4 deletions

View File

@ -120,6 +120,7 @@ class PullRequest < ActiveRecord::Base
# FIXME maybe move to warpc/grit?
def diff
return @diff if @diff.present?
diff = repo.git.native('diff', {:M => true}, "#{to_commit.id}...#{from_commit.id}")
if diff =~ /diff --git a/
@ -127,7 +128,7 @@ class PullRequest < ActiveRecord::Base
else
diff = ''
end
Grit::Diff.list_from_string(repo, diff)
@diff = Grit::Diff.list_from_string(repo, diff)
end
def set_user_and_time user
@ -211,9 +212,6 @@ class PullRequest < ActiveRecord::Base
end
def update_inline_comments
if self.comments.count > 0
diff = self.diff self.repo, self.common_ancestor, repo.commits(self.from_branch).first
end
self.comments.each do |c|
if c.data.present? # maybe need add new column 'actual'?
c.actual_inline_comment? diff, true