From 6afb03ee96a2f0c36e69a6da4e10dbe298c5b79f Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@gitlab.com>
Date: Fri, 20 Feb 2015 17:44:13 +0100
Subject: [PATCH] Remove incorrect footer from EmailsOnPush body.

See #1754.
---
 app/mailers/emails/projects.rb     | 2 ++
 app/views/layouts/notify.html.haml | 2 +-
 spec/mailers/notify_spec.rb        | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb
index f2e599ab28b..f3a2ae14d35 100644
--- a/app/mailers/emails/projects.rb
+++ b/app/mailers/emails/projects.rb
@@ -38,6 +38,8 @@ module Emails
         @subject << @commits.first.title
       end
 
+      @disable_footer = true
+
       mail(from: sender(author_id),
            to: recipient,
            subject: @subject)
diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml
index 8cca80e5248..eb5da470160 100644
--- a/app/views/layouts/notify.html.haml
+++ b/app/views/layouts/notify.html.haml
@@ -27,5 +27,5 @@
         - if @target_url
           #{link_to "View it on GitLab", @target_url}
           = email_action @target_url
-        - if @project
+        - if @project && !@disable_footer
           You're receiving this notification because you are a member of the #{link_to_unless @target_url, @project.name_with_namespace, namespace_project_url(@project.namespace, @project)} project team.
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index ae2b61262bd..41b0daacded 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -597,6 +597,10 @@ describe Notify do
     it 'contains a link to the diff' do
       is_expected.to have_body_text /#{diff_path}/
     end
+
+    it 'doesn not contain the misleading footer' do
+      is_expected.not_to have_body_text /you are a member of/
+    end
   end
 
   describe 'email on push with a single commit' do
-- 
GitLab