summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-12-10 13:59:17 +0100
committerRémy Coutable <remy@rymai.me>2018-12-10 13:59:33 +0100
commitd78272a13b50e912b1ac946da8eec2e75bc6eb41 (patch)
tree7786eb58b9c8ed4859a4cf5191a70733a8fdfddd
parent5a727a4d36674d02369f4ef8ed257ea9d17570e7 (diff)
downloadgitlab-ce-d78272a13b50e912b1ac946da8eec2e75bc6eb41.tar.gz
Fix a frozen string error in app/mailers/notify.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--app/mailers/notify.rb2
-rw-r--r--changelogs/unreleased/55104-frozenerror-can-t-modify-frozen-string.yml5
-rw-r--r--spec/mailers/notify_spec.rb4
3 files changed, 8 insertions, 3 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 662f3e00047..88ad4c3e893 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -166,7 +166,7 @@ class Notify < BaseMailer
headers['In-Reply-To'] = message_id(model)
headers['References'] = [message_id(model)]
- headers[:subject]&.prepend('Re: ')
+ headers[:subject] = "Re: #{headers[:subject]}" if headers[:subject]
mail_thread(model, headers)
end
diff --git a/changelogs/unreleased/55104-frozenerror-can-t-modify-frozen-string.yml b/changelogs/unreleased/55104-frozenerror-can-t-modify-frozen-string.yml
new file mode 100644
index 00000000000..994859b1d1d
--- /dev/null
+++ b/changelogs/unreleased/55104-frozenerror-can-t-modify-frozen-string.yml
@@ -0,0 +1,5 @@
+---
+title: Fix a frozen string error in app/mailers/notify.rb
+merge_request: 23683
+author:
+type: fixed
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 150c00e4bfe..1d17aec0ded 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -28,8 +28,8 @@ describe Notify do
end
def have_referable_subject(referable, reply: false)
- prefix = referable.project ? "#{referable.project.name} | " : ''
- prefix.prepend('Re: ') if reply
+ prefix = (referable.project ? "#{referable.project.name} | " : '').freeze
+ prefix = "Re: #{prefix}" if reply
suffix = "#{referable.title} (#{referable.to_reference})"