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
Jérome Perrin
gitlab-ce
Commits
db582b63
Commit
db582b63
authored
Dec 17, 2011
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notification when created merge request
parent
7713f7fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
app/mailers/notify.rb
app/mailers/notify.rb
+7
-0
app/models/mailer_observer.rb
app/models/mailer_observer.rb
+8
-1
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+20
-0
No files found.
app/mailers/notify.rb
View file @
db582b63
...
@@ -38,4 +38,11 @@ class Notify < ActionMailer::Base
...
@@ -38,4 +38,11 @@ class Notify < ActionMailer::Base
@issue
=
note
.
noteable
@issue
=
note
.
noteable
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
end
end
def
new_merge_request_email
(
merge_request
)
@user
=
merge_request
.
assignee
@merge_request
=
merge_request
@project
=
merge_request
.
project
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@merge_request
.
title
}
"
)
end
end
end
app/models/mailer_observer.rb
View file @
db582b63
class
MailerObserver
<
ActiveRecord
::
Observer
class
MailerObserver
<
ActiveRecord
::
Observer
observe
:issue
,
:user
,
:note
,
:
snippe
t
observe
:issue
,
:user
,
:note
,
:
merge_reques
t
cattr_accessor
:current_user
cattr_accessor
:current_user
def
after_create
(
model
)
def
after_create
(
model
)
new_issue
(
model
)
if
model
.
kind_of?
(
Issue
)
new_issue
(
model
)
if
model
.
kind_of?
(
Issue
)
new_user
(
model
)
if
model
.
kind_of?
(
User
)
new_user
(
model
)
if
model
.
kind_of?
(
User
)
new_note
(
model
)
if
model
.
kind_of?
(
Note
)
new_note
(
model
)
if
model
.
kind_of?
(
Note
)
new_merge_request
(
model
)
if
model
.
kind_of?
(
MergeRequest
)
end
end
protected
protected
...
@@ -38,4 +39,10 @@ class MailerObserver < ActiveRecord::Observer
...
@@ -38,4 +39,10 @@ class MailerObserver < ActiveRecord::Observer
end
end
end
end
def
new_merge_request
(
merge_request
)
if
merge_request
.
assignee
!=
current_user
Notify
.
new_merge_request_email
(
merge_request
).
deliver
end
end
end
end
app/views/notify/new_merge_request_email.html.haml
0 → 100644
View file @
db582b63
%td
.content
{
:align
=>
"left"
,
:style
=>
"font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;"
,
:valign
=>
"top"
,
:width
=>
"600"
}
%table
{
:border
=>
"0"
,
:cellpadding
=>
"0"
,
:cellspacing
=>
"0"
,
:style
=>
"color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;"
,
:width
=>
"600"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:align
=>
"left"
,
:style
=>
"padding: 20px 0 0;"
}
%h2
{
:style
=>
"color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "
}
New Merge Request
=
link_to
truncate
(
@merge_request
.
title
,
:length
=>
16
),
project_merge_request_url
(
@project
,
@merge_request
)
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%tr
%td
{
:style
=>
"font-size: 1px; line-height: 1px;"
,
:width
=>
"21"
}
%td
{
:style
=>
"padding: 15px 0 15px;"
,
:valign
=>
"top"
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Branches:
#{
@merge_request
.
source_branch
}
→
#{
@merge_request
.
target_branch
}
%p
{
:style
=>
"color:#767676; font-weight: normal; margin: 0; padding: 0; line-height: 20px; font-size: 12px;font-family: Helvetica, Arial, sans-serif; "
}
Asignee:
#{
@merge_request
.
author
.
name
}
→
#{
@merge_request
.
assignee
.
name
}
%td
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