From a15353e460cf7f626a137104c4930e3e559c6150 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 27 Mar 2014 00:02:28 +0400 Subject: [PATCH] #345: fixed: usage of name_with_owner --- app/models/concerns/feed/issue.rb | 6 +++--- .../home/partials/_new_comment_commit_notification.haml | 4 ++-- .../user_mailer/git_delete_branch_notification.html.haml | 3 ++- app/views/user_mailer/git_new_push_notification.html.haml | 7 ++++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/models/concerns/feed/issue.rb b/app/models/concerns/feed/issue.rb index b19ea3a8d..5d18f8f35 100644 --- a/app/models/concerns/feed/issue.rb +++ b/app/models/concerns/feed/issue.rb @@ -2,12 +2,12 @@ module Feed::Issue extend ActiveSupport::Concern included do - after_create :new_issue_notifications + after_commit :new_issue_notifications, on: :create - after_create :send_assign_notifications, if: ->(i) { i.assignee } + after_commit :send_assign_notifications, on: :create, if: ->(i) { i.assignee } after_update -> { send_assign_notifications(:update) } - after_create :send_hooks + after_commit :send_hooks, on: :create after_update -> { send_hooks(:update) }, if: ->(i) { i.previous_changes['status'].present? } end diff --git a/app/views/home/partials/_new_comment_commit_notification.haml b/app/views/home/partials/_new_comment_commit_notification.haml index 6da76bc68..246626ff1 100644 --- a/app/views/home/partials/_new_comment_commit_notification.haml +++ b/app/views/home/partials/_new_comment_commit_notification.haml @@ -1,11 +1,11 @@ -user= User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) +- name_with_owner = "#{project_owner}/#{project_name}" .top .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: 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}")}) - - name_with_owner = "#{project_owner}/#{project_name}" + = raw t("notifications.bodies.new_comment_notification.commit_content", {commit_link: link_to(commit_message, commit_path(name_with_owner, commit_id) + "#comment#{comment_id}")}) = raw t("notifications.bodies.project", project_link: link_to(name_with_owner, project_path(name_with_owner)) ) .both = datetime_moment activity_feed.created_at, tag: :span, class: 'date' diff --git a/app/views/user_mailer/git_delete_branch_notification.html.haml b/app/views/user_mailer/git_delete_branch_notification.html.haml index e9e6faf7f..885ecec04 100644 --- a/app/views/user_mailer/git_delete_branch_notification.html.haml +++ b/app/views/user_mailer/git_delete_branch_notification.html.haml @@ -3,6 +3,7 @@ %p - _user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email, true) : nil = t('notifications.bodies.delete_branch', branch_name: branch_name, user_link: _user_link).html_safe - = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) + - name_with_owner = "#{project_owner}/#{project_name}" + = raw t("notifications.bodies.project", project_link: link_to(name_with_owner, project_url(name_with_owner)) ) = render 'footer' \ No newline at end of file diff --git a/app/views/user_mailer/git_new_push_notification.html.haml b/app/views/user_mailer/git_new_push_notification.html.haml index 169b86676..845d545eb 100644 --- a/app/views/user_mailer/git_new_push_notification.html.haml +++ b/app/views/user_mailer/git_new_push_notification.html.haml @@ -1,18 +1,19 @@ - user = User.where(email: user_email).first || User.new(email: user_email) if defined?(user_email) +- name_with_owner = "#{project_owner}/#{project_name}" %p - _user_link = defined?(user_email) ? user_link(user, defined?(user_name) ? user_name : user_email, true) : nil = raw t("notifications.bodies.#{change_type}_branch", {branch_name: branch_name, user_link: _user_link}) - = raw t("notifications.bodies.project", project_link: link_to("#{project_owner}/#{project_name}", project_url(project_owner, project_name)) ) + = raw t("notifications.bodies.project", project_link: link_to(name_with_owner, project_url(name_with_owner)) ) %p - last_commits.each do |commit| - = link_to shortest_hash_id(commit[0]), commit_url(project_owner, project_name, commit[0]) + = link_to shortest_hash_id(commit[0]), commit_url(name_with_owner, commit[0]) = commit[1] %br - if defined? other_commits %br =link_to t('notifications.bodies.more_commits', count: other_commits_count, commits: commits_pluralize(other_commits_count)), - diff_url(project_owner, project_name, diff: other_commits) + diff_url(name_with_owner, diff: other_commits) = render 'footer' \ No newline at end of file