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
Kazuhiko Shiozaki
gitlab-ce
Commits
c26b001e
Commit
c26b001e
authored
Apr 14, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set EmailsOnPush reply-to address to committer email when enabled.
parent
ae6d0aaa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
12 deletions
+40
-12
CHANGELOG
CHANGELOG
+1
-0
app/mailers/emails/projects.rb
app/mailers/emails/projects.rb
+11
-3
app/mailers/notify.rb
app/mailers/notify.rb
+13
-9
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+15
-0
No files found.
CHANGELOG
View file @
c26b001e
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.10.0 (unreleased)
v 7.10.0 (unreleased)
- Set EmailsOnPush reply-to address to committer email when enabled.
- Fix broken file browsing with a submodule that contains a relative link (Stan Hu)
- Fix broken file browsing with a submodule that contains a relative link (Stan Hu)
- Fix persistent XSS vulnerability around profile website URLs.
- Fix persistent XSS vulnerability around profile website URLs.
- Fix project import URL regex to prevent arbitary local repos from being imported.
- Fix project import URL regex to prevent arbitary local repos from being imported.
...
...
app/mailers/emails/projects.rb
View file @
c26b001e
...
@@ -84,9 +84,17 @@ module Emails
...
@@ -84,9 +84,17 @@ module Emails
@disable_footer
=
true
@disable_footer
=
true
mail
(
from:
sender
(
author_id
,
send_from_committer_email
),
reply_to
=
to:
recipient
,
if
send_from_committer_email
&&
can_send_from_user_email?
(
@author
)
subject:
@subject
)
@author
.
email
else
Gitlab
.
config
.
gitlab
.
email_reply_to
end
mail
(
from:
sender
(
author_id
,
send_from_committer_email
),
reply_to:
reply_to
,
to:
recipient
,
subject:
@subject
)
end
end
end
end
end
end
app/mailers/notify.rb
View file @
c26b001e
...
@@ -60,20 +60,24 @@ class Notify < ActionMailer::Base
...
@@ -60,20 +60,24 @@ class Notify < ActionMailer::Base
address
address
end
end
def
can_send_from_user_email?
(
sender
)
sender_domain
=
sender
.
email
.
split
(
"@"
).
last
self
.
class
.
allowed_email_domains
.
include?
(
sender_domain
)
end
# Return an email address that displays the name of the sender.
# Return an email address that displays the name of the sender.
# Only the displayed name changes; the actual email address is always the same.
# Only the displayed name changes; the actual email address is always the same.
def
sender
(
sender_id
,
send_from_user_email
=
false
)
def
sender
(
sender_id
,
send_from_user_email
=
false
)
if
sender
=
User
.
find
(
sender_id
)
return
unless
sender
=
User
.
find
(
sender_id
)
address
=
default_sender_address
address
.
display_name
=
sender
.
name
address
=
default_sender_address
address
.
display_name
=
sender
.
name
sender_domain
=
sender
.
email
.
split
(
"@"
).
last
if
send_from_user_email
&&
can_send_from_user_email?
(
sender
)
if
send_from_user_email
&&
self
.
class
.
allowed_email_domains
.
include?
(
sender_domain
)
address
.
address
=
sender
.
email
address
.
address
=
sender
.
email
end
address
.
format
end
end
address
.
format
end
end
# Look up a User by their ID and return their email address
# Look up a User by their ID and return their email address
...
...
spec/mailers/notify_spec.rb
View file @
c26b001e
...
@@ -725,6 +725,11 @@ describe Notify do
...
@@ -725,6 +725,11 @@ describe Notify do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
user
.
email
)
expect
(
sender
.
address
).
to
eq
(
user
.
email
)
end
end
it
"is set to reply to the committer email"
do
sender
=
subject
.
header
[
:reply_to
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
user
.
email
)
end
end
end
context
"when the committer email domain is not completely within the GitLab domain"
do
context
"when the committer email domain is not completely within the GitLab domain"
do
...
@@ -738,6 +743,11 @@ describe Notify do
...
@@ -738,6 +743,11 @@ describe Notify do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
end
end
it
"is set to reply to the default email"
do
sender
=
subject
.
header
[
:reply_to
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
gitlab_sender_reply_to
)
end
end
end
context
"when the committer email domain is outside the GitLab domain"
do
context
"when the committer email domain is outside the GitLab domain"
do
...
@@ -751,6 +761,11 @@ describe Notify do
...
@@ -751,6 +761,11 @@ describe Notify do
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
sender
=
subject
.
header
[
:from
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
expect
(
sender
.
address
).
to
eq
(
gitlab_sender
)
end
end
it
"is set to reply to the default email"
do
sender
=
subject
.
header
[
:reply_to
].
addrs
[
0
]
expect
(
sender
.
address
).
to
eq
(
gitlab_sender_reply_to
)
end
end
end
end
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