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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
f45b03e7
Commit
f45b03e7
authored
Sep 27, 2016
by
Douwe Maan
Committed by
Ruben Davila
Sep 28, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'fix-unsubscribe-header'
parent
16518f6a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
app/mailers/notify.rb
app/mailers/notify.rb
+1
-1
spec/features/unsubscribe_links_spec.rb
spec/features/unsubscribe_links_spec.rb
+1
-1
spec/mailers/shared/notify.rb
spec/mailers/shared/notify.rb
+2
-1
No files found.
app/mailers/notify.rb
View file @
f45b03e7
...
@@ -109,7 +109,7 @@ class Notify < BaseMailer
...
@@ -109,7 +109,7 @@ class Notify < BaseMailer
headers
[
'X-GitLab-Reply-Key'
]
=
reply_key
headers
[
'X-GitLab-Reply-Key'
]
=
reply_key
if
!
@labels_url
&&
@sent_notification
&&
@sent_notification
.
unsubscribable?
if
!
@labels_url
&&
@sent_notification
&&
@sent_notification
.
unsubscribable?
headers
[
'List-Unsubscribe'
]
=
unsubscribe_sent_notification_url
(
@sent_notification
,
force:
true
)
headers
[
'List-Unsubscribe'
]
=
"<
#{
unsubscribe_sent_notification_url
(
@sent_notification
,
force:
true
)
}
>"
@sent_notification_url
=
unsubscribe_sent_notification_url
(
@sent_notification
)
@sent_notification_url
=
unsubscribe_sent_notification_url
(
@sent_notification
)
end
end
...
...
spec/features/unsubscribe_links_spec.rb
View file @
f45b03e7
...
@@ -11,7 +11,7 @@ describe 'Unsubscribe links', feature: true do
...
@@ -11,7 +11,7 @@ describe 'Unsubscribe links', feature: true do
let
(
:mail
)
{
ActionMailer
::
Base
.
deliveries
.
last
}
let
(
:mail
)
{
ActionMailer
::
Base
.
deliveries
.
last
}
let
(
:body
)
{
Capybara
::
Node
::
Simple
.
new
(
mail
.
default_part_body
.
to_s
)
}
let
(
:body
)
{
Capybara
::
Node
::
Simple
.
new
(
mail
.
default_part_body
.
to_s
)
}
let
(
:header_link
)
{
mail
.
header
[
'List-Unsubscribe'
]
}
let
(
:header_link
)
{
mail
.
header
[
'List-Unsubscribe'
]
.
to_s
[
1
..-
2
]
}
# Strip angle brackets
let
(
:body_link
)
{
body
.
find_link
(
'unsubscribe'
)[
'href'
]
}
let
(
:body_link
)
{
body
.
find_link
(
'unsubscribe'
)[
'href'
]
}
before
do
before
do
...
...
spec/mailers/shared/notify.rb
View file @
f45b03e7
...
@@ -169,8 +169,9 @@ shared_examples 'it should show Gmail Actions View Commit link' do
...
@@ -169,8 +169,9 @@ shared_examples 'it should show Gmail Actions View Commit link' do
end
end
shared_examples
'an unsubscribeable thread'
do
shared_examples
'an unsubscribeable thread'
do
it
'has a List-Unsubscribe header'
do
it
'has a List-Unsubscribe header
in the correct format
'
do
is_expected
.
to
have_header
'List-Unsubscribe'
,
/unsubscribe/
is_expected
.
to
have_header
'List-Unsubscribe'
,
/unsubscribe/
is_expected
.
to
have_header
'List-Unsubscribe'
,
/^<.+>$/
end
end
it
{
is_expected
.
to
have_body_text
/unsubscribe/
}
it
{
is_expected
.
to
have_body_text
/unsubscribe/
}
...
...
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