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
d73a18fe
Commit
d73a18fe
authored
Jan 28, 2016
by
Douwe Maan
Committed by
Robert Speicher
Feb 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add full diff highlighting to EmailsOnPush
parent
02f3a6e0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
17 deletions
+84
-17
CHANGELOG-EE
CHANGELOG-EE
+1
-0
app/assets/stylesheets/mailers/repository_push_email.scss
app/assets/stylesheets/mailers/repository_push_email.scss
+42
-0
app/helpers/emails_helper.rb
app/helpers/emails_helper.rb
+6
-6
app/mailers/notify.rb
app/mailers/notify.rb
+2
-0
app/views/layouts/notify.html.haml
app/views/layouts/notify.html.haml
+1
-0
app/views/notify/repository_push_email.html.haml
app/views/notify/repository_push_email.html.haml
+20
-8
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+2
-2
app/workers/emails_on_push_worker.rb
app/workers/emails_on_push_worker.rb
+5
-1
config/application.rb
config/application.rb
+1
-0
lib/gitlab/email/message/repository_push.rb
lib/gitlab/email/message/repository_push.rb
+4
-0
No files found.
CHANGELOG-EE
View file @
d73a18fe
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.6.0 (unreleased)
- Improve weight filter for issues
- Add full diff highlighting to Email on push
- [Elastic] Add elastic checker to gitlab:check
- [Elastic] Added UPDATE_INDEX option to rake task
- [Elastic] Removing repository and wiki index after removing project
...
...
app/assets/stylesheets/mailers/repository_push_email.scss
0 → 100644
View file @
d73a18fe
@import
"framework/variables"
;
table
.code
{
width
:
100%
;
font-family
:
$monospace_font
;
border
:
none
;
border-collapse
:
separate
;
margin
:
0px
;
padding
:
0px
;
-premailer-cellpadding
:
0
;
-premailer-cellspacing
:
0
;
-premailer-width
:
100%
;
td
{
line-height
:
$code_line_height
;
font-size
:
$code_font_size
;
}
td
.diff-line-num
{
margin
:
0px
;
padding
:
0px
;
border
:
none
;
background
:
$background-color
;
color
:
rgba
(
0
,
0
,
0
,
0
.3
);
padding
:
0px
5px
;
border-right
:
1px
solid
$border-color
;
text-align
:
right
;
min-width
:
35px
;
max-width
:
50px
;
width
:
35px
;
}
td
.line_content
{
display
:
block
;
margin
:
0px
;
padding
:
0px
0
.5em
;
border
:
none
;
white-space
:
pre
;
}
}
@import
"highlight/white"
;
app/helpers/emails_helper.rb
View file @
d73a18fe
...
...
@@ -32,12 +32,6 @@ module EmailsHelper
nil
end
def
color_email_diff
(
diffcontent
)
formatter
=
Rouge
::
Formatters
::
HTML
.
new
(
css_class:
'highlight'
,
inline_theme:
'github'
)
lexer
=
Rouge
::
Lexers
::
Diff
raw
formatter
.
format
(
lexer
.
lex
(
diffcontent
))
end
def
password_reset_token_valid_time
valid_hours
=
Devise
.
reset_password_within
/
60
/
60
if
valid_hours
>=
24
...
...
@@ -56,4 +50,10 @@ module EmailsHelper
msg
=
"This link is valid for
#{
password_reset_token_valid_time
}
. "
msg
<<
"After it expires, you can
#{
link_tag
}
."
end
# Overrides
def
diff_hard_limit_enabled?
false
end
end
app/mailers/notify.rb
View file @
d73a18fe
...
...
@@ -11,6 +11,8 @@ class Notify < BaseMailer
include
Emails
::
Builds
add_template_helper
MergeRequestsHelper
add_template_helper
DiffHelper
add_template_helper
BlobHelper
add_template_helper
EmailsHelper
def
test_email
(
recipient_email
,
subject
,
body
)
...
...
app/views/layouts/notify.html.haml
View file @
d73a18fe
...
...
@@ -4,6 +4,7 @@
%title
GitLab
=
stylesheet_link_tag
'notify'
=
yield
:head
%body
%div
.content
=
yield
...
...
app/views/notify/repository_push_email.html.haml
View file @
d73a18fe
=
content_for
:head
do
=
stylesheet_link_tag
'mailers/repository_push_email'
%h3
#{
@message
.
author_name
}
#{
@message
.
action_name
}
#{
@message
.
ref_type
}
#{
@message
.
ref_name
}
at
#{
link_to
(
@message
.
project_name_with_namespace
,
namespace_project_url
(
@message
.
project_namespace
,
@message
.
project
))
}
...
...
@@ -43,25 +46,34 @@
=
diff
.
new_path
-
unless
@message
.
disable_diffs?
-
diff_files
=
safe_diff_files
(
@message
.
diffs
,
@message
.
diff_refs
)
%h4
Changes:
-
@message
.
diffs
.
each_with_index
do
|
diff
,
i
|
-
diff_files
.
each_with_index
do
|
diff_file
,
i
|
%li
{
id:
"diff-#{i}"
}
%a
{
href:
@message
.
target_url
+
"#diff-#{i}"
}
-
if
diff
.
deleted_file
-
if
diff
_file
.
deleted_file
%strong
=
diff
.
old_path
=
diff
_file
.
old_path
deleted
-
elsif
diff
.
renamed_file
-
elsif
diff
_file
.
renamed_file
%strong
=
diff
.
old_path
=
diff
_file
.
old_path
→
%strong
=
diff
.
new_path
=
diff
_file
.
new_path
-
else
%strong
=
diff
.
new_path
=
diff
_file
.
new_path
%hr
=
color_email_diff
(
diff
.
diff
)
-
diff_commit
=
diff_file
.
deleted_file
?
@message
.
diff_refs
.
first
:
@message
.
diff_refs
.
last
-
blob
=
@message
.
project
.
repository
.
blob_for_diff
(
diff_commit
,
diff_file
)
-
if
blob
&&
blob
.
respond_to?
(
:text?
)
&&
blob_text_viewable?
(
blob
)
%table
.code.white
-
diff_file
.
highlighted_diff_lines
.
each
do
|
line
|
=
render
"projects/diffs/line"
,
{
line:
line
,
diff_file:
diff_file
,
line_code:
nil
,
plain:
true
}
-
else
No preview for this file type
%br
-
if
@message
.
compare_timeout
...
...
app/views/projects/diffs/_file.html.haml
View file @
d73a18fe
...
...
@@ -40,8 +40,8 @@
=
view_file_btn
(
diff_commit
.
id
,
diff_file
,
project
)
.diff-content.diff-wrap-lines
-# Skip
p all non
non-supported blobs
-
return
unless
blob
.
respond_to?
(
'text?'
)
-# Skip
all
non-supported blobs
-
return
unless
blob
.
respond_to?
(
:text?
)
-
if
blob_text_viewable?
(
blob
)
-
if
diff_view
==
'parallel'
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
,
index:
i
...
...
app/workers/emails_on_push_worker.rb
View file @
d73a18fe
...
...
@@ -25,15 +25,18 @@ class EmailsOnPushWorker
:push
end
diff_refs
=
nil
compare
=
nil
reverse_compare
=
false
if
action
==
:push
compare
=
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
before_sha
,
after_sha
)
diff_refs
=
[
project
.
merge_base_commit
(
before_sha
,
after_sha
),
project
.
commit
(
after_sha
)]
return
false
if
compare
.
same
if
compare
.
commits
.
empty?
compare
=
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
after_sha
,
before_sha
)
diff_refs
=
[
project
.
merge_base_commit
(
after_sha
,
before_sha
),
project
.
commit
(
before_sha
)]
reverse_compare
=
true
...
...
@@ -41,7 +44,7 @@ class EmailsOnPushWorker
end
end
recipients
.
split
(
" "
)
.
each
do
|
recipient
|
recipients
.
split
.
each
do
|
recipient
|
begin
Notify
.
repository_push_email
(
project_id
,
...
...
@@ -51,6 +54,7 @@ class EmailsOnPushWorker
action:
action
,
compare:
compare
,
reverse_compare:
reverse_compare
,
diff_refs:
diff_refs
,
send_from_committer_email:
send_from_committer_email
,
disable_diffs:
disable_diffs
).
deliver_now
...
...
config/application.rb
View file @
d73a18fe
...
...
@@ -49,6 +49,7 @@ module Gitlab
config
.
assets
.
precompile
<<
"*.png"
config
.
assets
.
precompile
<<
"print.css"
config
.
assets
.
precompile
<<
"notify.css"
config
.
assets
.
precompile
<<
"mailers/repository_push_email.css"
# Version of your assets, change this if you want to expire all your assets
config
.
assets
.
version
=
'1.0'
...
...
lib/gitlab/email/message/repository_push.rb
View file @
d73a18fe
...
...
@@ -49,6 +49,10 @@ module Gitlab
@opts
[
:compare
]
end
def
diff_refs
@opts
[
:diff_refs
]
end
def
compare_timeout
compare
.
timeout
if
compare
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