Improved commit author detection
This commit is contained in:
parent
f87f0201f0
commit
b4868a8972
2 changed files with 8 additions and 3 deletions
|
@ -50,6 +50,11 @@ class Project < ActiveRecord::Base
|
||||||
code
|
code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def team_member_by_name_or_email(email = nil, name = nil)
|
||||||
|
user = users.where("email like ? or name like ?", email, name).first
|
||||||
|
users_projects.find_by_user_id(user.id) if user
|
||||||
|
end
|
||||||
|
|
||||||
def common_notes
|
def common_notes
|
||||||
notes.where(:noteable_type => ["", nil])
|
notes.where(:noteable_type => ["", nil])
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
ago
|
ago
|
||||||
%td.commit
|
%td.commit
|
||||||
= link_to truncate(content_commit.safe_message, :length => fixed_mode? ? 40 : 80), project_commit_path(@project, content_commit), :class => "tree-commit-link"
|
= link_to truncate(content_commit.safe_message, :length => fixed_mode? ? 40 : 80), project_commit_path(@project, content_commit), :class => "tree-commit-link"
|
||||||
- user = @project.users.find_by_email(content_commit.author_email)
|
- tm = @project.team_member_by_name_or_email(content_commit.author_email, content_commit.author_name)
|
||||||
- if user
|
- if tm
|
||||||
= link_to "[#{user.name}]", project_team_member_path(@project, @project.users_projects.find_by_user_id(user.id))
|
= link_to "[#{tm.user_name}]", project_team_member_path(@project, tm)
|
||||||
|
|
Loading…
Reference in a new issue