From 54ebed236a16f15d9c478348159c34eb81438c97 Mon Sep 17 00:00:00 2001
From: Joseph Snyder <joe.snyder@kitware.com>
Date: Fri, 12 Apr 2024 14:37:43 -0400
Subject: [PATCH] Change default value of show_diff_preview_message

Change the default value of showw_diff_preview_message to be false
instead of true.

This would prevent the message from being shown on issues that do not
have notes to check for the setting, like a milestone.
---
 app/views/layouts/notify.html.haml | 3 ++-
 spec/mailers/notify_spec.rb        | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml
index 7199631abf37..4f9964fff143 100644
--- a/app/views/layouts/notify.html.haml
+++ b/app/views/layouts/notify.html.haml
@@ -1,5 +1,6 @@
 - note = local_assigns.fetch(:note, @note)
-- show_no_diff_preview_message = true
+-# Diff preview text should only appear when a note is available. Default value to be false
+- show_no_diff_preview_message = false
 - unless note.nil?
   - discussion = local_assigns.fetch(:discussion) { note.discussion } if note.part_of_discussion?
   - project = local_assigns.fetch(:project, @project)
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 566a3d108126..bbb5a77e89c5 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -137,6 +137,7 @@
           aggregate_failures do
             is_expected.to have_referable_subject(issue)
             is_expected.to have_body_text(project_issue_path(project, issue))
+            is_expected.not_to have_body_text 'This project does not include diff previews in email notifications'
           end
         end
 
-- 
GitLab