BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
59769fdb
Unverified
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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
projects.rb
app/mailers/emails/projects.rb
+1
-0
repository_push_email.html.haml
app/views/notify/repository_push_email.html.haml
+5
-0
repository_push_email.text.haml
app/views/notify/repository_push_email.text.haml
+5
-0
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