Commit d9698628 authored by Douwe Maan's avatar Douwe Maan

Add Commit#author and #committer.

parent 403b7271
......@@ -134,12 +134,13 @@ module CommitsHelper
# avatar: true will prepend the avatar image
# size: size of the avatar image in px
def commit_person_link(commit, options = {})
user = commit.send(options[:source])
source_name = clean(commit.send "#{options[:source]}_name".to_sym)
source_email = clean(commit.send "#{options[:source]}_email".to_sym)
user = User.find_for_commit(source_email, source_name)
person_name = user.nil? ? source_name : user.name
person_email = user.nil? ? source_email : user.email
person_name = user.try(:name) || source_name
person_email = user.try(:email) || source_email
text =
if options[:avatar]
......
......@@ -126,6 +126,14 @@ class Commit
"commit #{id}"
end
def author
User.find_for_commit(author_email, author_name)
end
def committer
User.find_for_commit(committer_email, committer_name)
end
def method_missing(m, *args, &block)
@raw.send(m, *args, &block)
end
......
......@@ -127,6 +127,6 @@ class GitPushService
end
def commit_user(commit)
User.find_for_commit(commit.author_email, commit.author_name) || user
commit.author || user
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment