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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
59769fdb
Commit
59769fdb
authored
Feb 12, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve compare logic for EmailOnPush service
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0bcabdaf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
app/mailers/emails/projects.rb
app/mailers/emails/projects.rb
+1
-0
app/views/notify/repository_push_email.html.haml
app/views/notify/repository_push_email.html.haml
+5
-0
app/views/notify/repository_push_email.text.haml
app/views/notify/repository_push_email.text.haml
+5
-0
app/workers/emails_on_push_worker.rb
app/workers/emails_on_push_worker.rb
+2
-2
No files found.
app/mailers/emails/projects.rb
View file @
59769fdb
...
...
@@ -17,6 +17,7 @@ module Emails
def
repository_push_email
(
project_id
,
recipient
,
author_id
,
branch
,
compare
)
@project
=
Project
.
find
(
project_id
)
@author
=
User
.
find
(
author_id
)
@compare
=
compare
@commits
=
Commit
.
decorate
(
compare
.
commits
)
@diffs
=
compare
.
diffs
@branch
=
branch
...
...
app/views/notify/repository_push_email.html.haml
View file @
59769fdb
...
...
@@ -21,3 +21,8 @@
%pre
=
diff
.
diff
%br
-
if
@compare
.
timeout
%h5
Huge diff. To prevent performance issues it was hidden
-
elsif
@compare
.
commits_over_limit?
%h5
Diff for big amount of commits is disabled
app/views/notify/repository_push_email.text.haml
View file @
59769fdb
...
...
@@ -18,3 +18,8 @@ Diff:
=
diff
.
new_path
||
diff
.
old_path
\=====================================
=
diff
.
diff
\
-
if
@compare
.
timeout
Huge diff. To prevent performance issues it was hidden
-
elsif
@compare
.
commits_over_limit?
Diff for big amount of commits is disabled
app/workers/emails_on_push_worker.rb
View file @
59769fdb
...
...
@@ -13,13 +13,13 @@ class EmailsOnPushWorker
return
true
end
compare
=
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
before_sha
,
after_sha
)
compare
=
Gitlab
::
Git
::
Compare
.
new
(
project
.
repository
.
raw_repository
,
before_sha
,
after_sha
,
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)
# Do not send emails if git compare failed
return
false
unless
compare
&&
compare
.
commits
.
present?
recipients
.
split
(
" "
).
each
do
|
recipient
|
Notify
.
delay
.
repository_push_email
(
project_id
,
recipient
,
author_id
,
branch
,
compare
)
Notify
.
repository_push_email
(
project_id
,
recipient
,
author_id
,
branch
,
compare
).
deliver
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