[#19] fixed error with outdated commit reference

This commit is contained in:
Alexander Machehin 2013-04-09 17:47:45 +06:00
parent a22be98f9b
commit 50235207a0
1 changed files with 3 additions and 3 deletions

View File

@ -13,16 +13,16 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
else
opts[:project]
end
if @project
commit = commit || @project.repo.commit(comment.created_from_commit_hash.to_s(16))
commit = commit || @project.repo.commit(comment.created_from_commit_hash.to_s(16)) if @project
if @project && commit
@committer = User.where(:email => commit.committer.email).first || commit.committer
@commit_hash = commit.id
@committed_date, @authored_date = commit.committed_date, commit.authored_date
@commit_message = commit.message
else
@committer = t('layout.commits.unknown_committer')
@commit_hash = comment.created_from_commit_hash
@commit_hash = comment.created_from_commit_hash.to_s(16)
@committed_date = @authored_date = comment.created_at
@commit_message = t('layout.commits.deleted')
end