Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
24f9fa11
Commit
24f9fa11
authored
Dec 11, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a potential frozen string error in app/mailers/notify.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
b388111f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
app/mailers/notify.rb
app/mailers/notify.rb
+2
-2
changelogs/unreleased/55183-frozenerror-can-t-modify-frozen-string-in-app-mailers-notify-rb.yml
...r-can-t-modify-frozen-string-in-app-mailers-notify-rb.yml
+5
-0
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+1
-9
spec/support/helpers/email_helpers.rb
spec/support/helpers/email_helpers.rb
+9
-0
No files found.
app/mailers/notify.rb
View file @
24f9fa11
...
@@ -128,7 +128,7 @@ class Notify < BaseMailer
...
@@ -128,7 +128,7 @@ class Notify < BaseMailer
address
.
display_name
=
reply_display_name
(
model
)
address
.
display_name
=
reply_display_name
(
model
)
end
end
fallback_reply_message_id
=
"<reply-
#{
reply_key
}
@
#{
Gitlab
.
config
.
gitlab
.
host
}
>"
.
freeze
fallback_reply_message_id
=
"<reply-
#{
reply_key
}
@
#{
Gitlab
.
config
.
gitlab
.
host
}
>"
headers
[
'References'
]
||=
[]
headers
[
'References'
]
||=
[]
headers
[
'References'
].
unshift
(
fallback_reply_message_id
)
headers
[
'References'
].
unshift
(
fallback_reply_message_id
)
...
@@ -178,7 +178,7 @@ class Notify < BaseMailer
...
@@ -178,7 +178,7 @@ class Notify < BaseMailer
headers
[
'X-GitLab-Discussion-ID'
]
=
note
.
discussion
.
id
if
note
.
part_of_discussion?
headers
[
'X-GitLab-Discussion-ID'
]
=
note
.
discussion
.
id
if
note
.
part_of_discussion?
headers
[
:subject
]
&
.
prepend
(
'Re: '
)
headers
[
:subject
]
=
"Re:
#{
headers
[
:subject
]
}
"
if
headers
[
:subject
]
mail_thread
(
model
,
headers
)
mail_thread
(
model
,
headers
)
end
end
...
...
changelogs/unreleased/55183-frozenerror-can-t-modify-frozen-string-in-app-mailers-notify-rb.yml
0 → 100644
View file @
24f9fa11
---
title
:
Fix a potential frozen string error in app/mailers/notify.rb
merge_request
:
23728
author
:
type
:
fixed
spec/mailers/notify_spec.rb
View file @
24f9fa11
...
@@ -4,6 +4,7 @@ require 'email_spec'
...
@@ -4,6 +4,7 @@ require 'email_spec'
describe
Notify
do
describe
Notify
do
include
EmailSpec
::
Helpers
include
EmailSpec
::
Helpers
include
EmailSpec
::
Matchers
include
EmailSpec
::
Matchers
include
EmailHelpers
include
RepoHelpers
include
RepoHelpers
include_context
'gitlab email notification'
include_context
'gitlab email notification'
...
@@ -27,15 +28,6 @@ describe Notify do
...
@@ -27,15 +28,6 @@ describe Notify do
description:
'My awesome description!'
)
description:
'My awesome description!'
)
end
end
def
have_referable_subject
(
referable
,
reply:
false
)
prefix
=
(
referable
.
project
?
"
#{
referable
.
project
.
name
}
| "
:
''
).
freeze
prefix
=
"Re:
#{
prefix
}
"
if
reply
suffix
=
"
#{
referable
.
title
}
(
#{
referable
.
to_reference
}
)"
have_subject
[
prefix
,
suffix
].
compact
.
join
end
context
'for a project'
do
context
'for a project'
do
shared_examples
'an assignee email'
do
shared_examples
'an assignee email'
do
it
'is sent to the assignee as the author'
do
it
'is sent to the assignee as the author'
do
...
...
spec/support/helpers/email_helpers.rb
View file @
24f9fa11
...
@@ -34,4 +34,13 @@ module EmailHelpers
...
@@ -34,4 +34,13 @@ module EmailHelpers
def
find_email_for
(
user
)
def
find_email_for
(
user
)
ActionMailer
::
Base
.
deliveries
.
find
{
|
d
|
d
.
to
.
include?
(
user
.
notification_email
)
}
ActionMailer
::
Base
.
deliveries
.
find
{
|
d
|
d
.
to
.
include?
(
user
.
notification_email
)
}
end
end
def
have_referable_subject
(
referable
,
include_project:
true
,
reply:
false
)
prefix
=
(
include_project
&&
referable
.
project
?
"
#{
referable
.
project
.
name
}
| "
:
''
).
freeze
prefix
=
"Re:
#{
prefix
}
"
if
reply
suffix
=
"
#{
referable
.
title
}
(
#{
referable
.
to_reference
}
)"
have_subject
[
prefix
,
suffix
].
compact
.
join
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment