diff --git a/app/helpers/activity_feeds_helper.rb b/app/helpers/activity_feeds_helper.rb index 2161a7582..b7e0058be 100644 --- a/app/helpers/activity_feeds_helper.rb +++ b/app/helpers/activity_feeds_helper.rb @@ -10,4 +10,8 @@ module ActivityFeedsHelper # removes multiple whitespaces in a row and strip it: feed_title = feed_title.gsub(/\s{2,}/, ' ').strip end + + def user_link user, user_name + user.persisted? ? link_to(user_name, user_path(user)) : user_name + end end 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 9c6f23edc..84816d827 100644 --- a/app/views/activity_feeds/partials/_git_new_push_notification.haml +++ b/app/views/activity_feeds/partials/_git_new_push_notification.haml @@ -1,10 +1,9 @@ +-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) .top - - if defined?(user_email) - .image - = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') + .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => defined?(user_name) ? link_to(user_name, user_path(user_id)) : user_email}) + = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => user_link(user, user_name)}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both %span.date= activity_feed.created_at diff --git a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml index 2f276d098..09f23f4d9 100644 --- a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml @@ -1,9 +1,9 @@ +-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) .top - .image - = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') + .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) ) + = raw t("notifications.bodies.new_comment_notification.title", :user_link => user_link(user, user_name)) = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_owner, project_name, commit_id) + "#comment#{comment_id}")}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both diff --git a/app/views/activity_feeds/partials/_new_comment_notification.haml b/app/views/activity_feeds/partials/_new_comment_notification.haml index bc626889d..ef4b4fa53 100644 --- a/app/views/activity_feeds/partials/_new_comment_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_notification.haml @@ -1,9 +1,9 @@ +-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) .top - .image - = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') + .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))}) + = raw t("notifications.bodies.new_comment_notification.title", {:user_link => user_link(user, user_name)}) = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_owner, project_name, issue_serial_id) + "#comment#{comment_id}")}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both diff --git a/app/views/activity_feeds/partials/_new_issue_notification.haml b/app/views/activity_feeds/partials/_new_issue_notification.haml index 1d9e1ca06..76eb29e16 100644 --- a/app/views/activity_feeds/partials/_new_issue_notification.haml +++ b/app/views/activity_feeds/partials/_new_issue_notification.haml @@ -1,9 +1,9 @@ +-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) .top - .image - = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') + .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)}) + = raw t("notifications.bodies.new_issue_notification", { :user_link => user_link(user, user_name), :issue_link => project_issue_path(project_owner, project_name, issue_serial_id)}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both %span.date= activity_feed.created_at diff --git a/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml b/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml index d21a3abd9..e431ce73e 100644 --- a/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml +++ b/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml @@ -1,9 +1,9 @@ +-user= User.where(:email => user_email).first || User.new(:email => user_email) if defined?(user_email) .top - .image - = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') + .image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted? .text %span - = raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))}) + = raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_link(user, user_name), :history_link => link_to("wiki", history_project_wiki_index_path(project_owner, project_name))}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) ) .both %span.date= activity_feed.created_at