diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index ff191ef64..81372b994 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -68,17 +68,18 @@ class ActivityFeedObserver < ActiveRecord::Observer project = Project.find_by_name(record.repo) last_commits = project.git_repository.repo.log(branch_name, nil).first(3) - first_commiter = User.find_by_email(last_commits[0].author.email) if last_commits.size > 0 + first_commiter = User.find_by_email(last_commits[0].author.email) unless last_commits.blank? last_commits = last_commits.collect do |commit| #:author => 'author' [commit.sha, commit.message] end if change_type == 'delete' kind = 'git_delete_branch_notification' - options = {:user_id => first_commiter.id, :user_name => first_commiter.name, :user_email => first_commiter.email, :project_id => project.id, :project_name => project.name, :branch_name => branch_name, :change_type => change_type} + options = {:project_id => project.id, :project_name => project.name, :branch_name => branch_name, :change_type => change_type} else kind = 'git_new_push_notification' options = {:project_id => project.id, :project_name => project.name, :last_commits => last_commits, :branch_name => branch_name, :change_type => change_type} + options.merge!({:user_id => first_commiter.id, :user_name => first_commiter.name, :user_email => first_commiter.email}) if first_commiter end project.owner_and_admin_ids.each do |recipient| diff --git a/app/views/activity_feeds/partials/_git_delete_branch_notification.haml b/app/views/activity_feeds/partials/_git_delete_branch_notification.haml index fa193e2cb..47907b719 100644 --- a/app/views/activity_feeds/partials/_git_delete_branch_notification.haml +++ b/app/views/activity_feeds/partials/_git_delete_branch_notification.haml @@ -1,13 +1,7 @@ .top - .image - =# image_tag(gravatar_url(activity_feed.user.email, 30)) - .text - %span.name - =# link_to activity_feed.user.uname, user_path(activity_feed.user.uname) - %br - %span.date= activity_feed.created_at - %br - %span.subject Branch #{ branch_name } has been deleted + %span.date= activity_feed.created_at + %br + %span.subject Branch #{ branch_name } has been deleted .both .fulltext Into project #{ link_to(project_name, project_path(project_id)) } diff --git a/app/views/activity_feeds/partials/_git_new_push_notification.haml b/app/views/activity_feeds/partials/_git_new_push_notification.haml index 9f7de7eeb..0e70af5fc 100644 --- a/app/views/activity_feeds/partials/_git_new_push_notification.haml +++ b/app/views/activity_feeds/partials/_git_new_push_notification.haml @@ -1,15 +1,22 @@ -.top - .image - = image_tag(gravatar_url(user_email, 30)) - .text - %span.name - = link_to user_name, user_path(user_id) - %br - %span.date= activity_feed.created_at +- if defined? user_email + .top + .image + = image_tag(gravatar_url(user_email, 30)) + .text + %span.name + = link_to user_name, user_path(user_id) %br - %span.subject Branch #{ branch_name } has been #{ change_type }d - .both + %span.date= activity_feed.created_at + %br + %span.subject Branch #{ branch_name } has been #{ change_type }d + .both .fulltext + - unless defined? user_email + %span.date= activity_feed.created_at + %br + Branch #{ branch_name } has been #{ change_type }d + %br + %br Into project #{ link_to(project_name, project_path(project_id)) } %br %br