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
Léo-Paul Géneau
gitlab-ce
Commits
854fbbfb
Commit
854fbbfb
authored
Nov 17, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up text emails
parent
938de311
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
14 deletions
+13
-14
app/models/discussion.rb
app/models/discussion.rb
+5
-2
app/views/notify/_note_mr_or_commit_email.text.erb
app/views/notify/_note_mr_or_commit_email.text.erb
+1
-1
app/views/notify/_simple_diff.text.erb
app/views/notify/_simple_diff.text.erb
+1
-1
app/views/notify/note_commit_email.text.erb
app/views/notify/note_commit_email.text.erb
+1
-3
app/views/notify/note_merge_request_email.text.erb
app/views/notify/note_merge_request_email.text.erb
+1
-3
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+4
-4
No files found.
app/models/discussion.rb
View file @
854fbbfb
...
@@ -165,18 +165,21 @@ class Discussion
...
@@ -165,18 +165,21 @@ class Discussion
# Returns an array of at most 16 highlighted lines above a diff note
# Returns an array of at most 16 highlighted lines above a diff note
def
truncated_diff_lines
(
highlight:
true
)
def
truncated_diff_lines
(
highlight:
true
)
initial_
lines
=
highlight
?
highlighted_diff_lines
:
diff_lines
lines
=
highlight
?
highlighted_diff_lines
:
diff_lines
prev_lines
=
[]
prev_lines
=
[]
initial_
lines
.
each
do
|
line
|
lines
.
each
do
|
line
|
if
line
.
meta?
if
line
.
meta?
prev_lines
.
clear
prev_lines
.
clear
else
else
prev_lines
<<
line
prev_lines
<<
line
break
if
for_line?
(
line
)
break
if
for_line?
(
line
)
prev_lines
.
shift
if
prev_lines
.
length
>=
NUMBER_OF_TRUNCATED_DIFF_LINES
prev_lines
.
shift
if
prev_lines
.
length
>=
NUMBER_OF_TRUNCATED_DIFF_LINES
end
end
end
end
prev_lines
prev_lines
end
end
...
...
app/views/notify/_note_mr_or_commit_email.text.erb
View file @
854fbbfb
<%
if
@
note
.
diff_note?
&&
@note
.
diff_file
-%>
<%
if
@
discussion
&&
@discussion
.
diff_file
-%>
on
<%=
@note
.
diff_file
.
file_path
-%>
on
<%=
@note
.
diff_file
.
file_path
-%>
<%
end
-%>
:
<%
end
-%>
:
...
...
app/views/notify/_simple_diff.text.erb
View file @
854fbbfb
<%
@discussion
.
truncated_diff_lines
(
highlight:
false
).
each
do
|
line
|
%>
<%
@discussion
.
truncated_diff_lines
(
highlight:
false
).
each
do
|
line
|
%>
<%=
"> "
+
line
.
text
%>
>
<%=
line
.
text
%>
<%
end
%>
<%
end
%>
app/views/notify/note_commit_email.text.erb
View file @
854fbbfb
<%
url
=
url_for
(
namespace_project_commit_url
(
@note
.
project
.
namespace
,
@note
.
project
,
id:
@commit
.
id
,
anchor:
"note_
#{
@note
.
id
}
"
))
%>
New comment for Commit
<%=
@commit
.
short_id
-%>
New comment for Commit
<%=
@commit
.
short_id
-%>
<%=
render
partial:
'note_mr_or_commit_email'
,
locals:
{
url:
url
}
%>
<%=
render
partial:
'note_mr_or_commit_email'
,
locals:
{
url:
@target_
url
}
%>
app/views/notify/note_merge_request_email.text.erb
View file @
854fbbfb
<%
url
=
url_for
(
namespace_project_merge_request_url
(
@merge_request
.
target_project
.
namespace
,
@merge_request
.
target_project
,
@merge_request
,
anchor:
"note_
#{
@note
.
id
}
"
))
%>
New comment for Merge Request
<%=
@merge_request
.
to_reference
-%>
New comment for Merge Request
<%=
@merge_request
.
to_reference
-%>
<%=
render
partial:
'note_mr_or_commit_email'
,
locals:
{
url:
url
}
%>
<%=
render
partial:
'note_mr_or_commit_email'
,
locals:
{
url:
@target_
url
}
%>
spec/mailers/notify_spec.rb
View file @
854fbbfb
...
@@ -50,7 +50,7 @@ describe Notify do
...
@@ -50,7 +50,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
stub_application_setting
(
email_author_in_body:
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -229,7 +229,7 @@ describe Notify do
...
@@ -229,7 +229,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
stub_application_setting
(
email_author_in_body:
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -607,7 +607,7 @@ describe Notify do
...
@@ -607,7 +607,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
stub_application_setting
(
email_author_in_body:
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
@@ -726,7 +726,7 @@ describe Notify do
...
@@ -726,7 +726,7 @@ describe Notify do
context
'when enabled email_author_in_body'
do
context
'when enabled email_author_in_body'
do
before
do
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:email_author_in_body
).
and_return
(
true
)
stub_application_setting
(
email_author_in_body:
true
)
end
end
it
'contains a link to note author'
do
it
'contains a link to note author'
do
...
...
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