Continue refactoring. Use repostory and team

This commit is contained in:
Dmitriy Zaporozhets 2013-01-04 08:43:25 +02:00
parent 39ba934c0a
commit dccd8b6eaa
42 changed files with 219 additions and 179 deletions

View file

@ -204,7 +204,7 @@ class Event < ActiveRecord::Base
# Max 20 commits from push DESC
def commits
@commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
@commits ||= data[:commits].map { |commit| repository.commit(commit[:id]) }.reverse
end
def commits_count
@ -225,14 +225,18 @@ class Event < ActiveRecord::Base
end
end
def repository
project.repository
end
def parent_commit
project.commit(commit_from)
repository.commit(commit_from)
rescue => ex
nil
end
def last_commit
project.commit(commit_to)
repository.commit(commit_to)
rescue => ex
nil
end