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
Kazuhiko Shiozaki
gitlab-ce
Commits
53ce00f7
Commit
53ce00f7
authored
Dec 25, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #231 from CedricGatay/feature/commit_author_mail_for_note
Alert only commit author on note
parents
bac0fa2c
c0b47d32
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
2 deletions
+13
-2
app/controllers/notes_controller.rb
app/controllers/notes_controller.rb
+1
-0
app/mailers/notify.rb
app/mailers/notify.rb
+1
-0
app/models/mailer_observer.rb
app/models/mailer_observer.rb
+1
-1
app/models/note.rb
app/models/note.rb
+5
-0
app/views/notes/_form.html.haml
app/views/notes/_form.html.haml
+5
-1
No files found.
app/controllers/notes_controller.rb
View file @
53ce00f7
...
@@ -13,6 +13,7 @@ class NotesController < ApplicationController
...
@@ -13,6 +13,7 @@ class NotesController < ApplicationController
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
=
@project
.
notes
.
new
(
params
[
:note
])
@note
.
author
=
current_user
@note
.
author
=
current_user
@note
.
notify
=
true
if
params
[
:notify
]
==
'1'
@note
.
notify
=
true
if
params
[
:notify
]
==
'1'
@note
.
notify_author
=
true
if
params
[
:notify_author
]
==
'1'
@note
.
save
@note
.
save
respond_to
do
|
format
|
respond_to
do
|
format
|
...
...
app/mailers/notify.rb
View file @
53ce00f7
...
@@ -28,6 +28,7 @@ class Notify < ActionMailer::Base
...
@@ -28,6 +28,7 @@ class Notify < ActionMailer::Base
@note
=
note
@note
=
note
@project
=
note
.
project
@project
=
note
.
project
@commit
=
@project
.
repo
.
commits
(
note
.
noteable_id
).
first
@commit
=
@project
.
repo
.
commits
(
note
.
noteable_id
).
first
return
unless
(
note
.
notify
or
(
note
.
notify_author
and
@commit
.
author
.
email
==
@user
.
email
)
)
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
mail
(
:to
=>
@user
.
email
,
:subject
=>
"gitlab |
#{
@note
.
project
.
name
}
"
)
end
end
...
...
app/models/mailer_observer.rb
View file @
53ce00f7
...
@@ -27,7 +27,7 @@ class MailerObserver < ActiveRecord::Observer
...
@@ -27,7 +27,7 @@ class MailerObserver < ActiveRecord::Observer
end
end
def
new_note
(
note
)
def
new_note
(
note
)
return
unless
note
.
notify
return
unless
note
.
notify
or
note
.
notify_author
note
.
project
.
users
.
reject
{
|
u
|
u
.
id
==
current_user
.
id
}
.
each
do
|
u
|
note
.
project
.
users
.
reject
{
|
u
|
u
.
id
==
current_user
.
id
}
.
each
do
|
u
|
case
note
.
noteable_type
case
note
.
noteable_type
when
"Commit"
then
when
"Commit"
then
...
...
app/models/note.rb
View file @
53ce00f7
...
@@ -14,6 +14,7 @@ class Note < ActiveRecord::Base
...
@@ -14,6 +14,7 @@ class Note < ActiveRecord::Base
attr_protected
:author
,
:author_id
attr_protected
:author
,
:author_id
attr_accessor
:notify
attr_accessor
:notify
attr_accessor
:notify_author
validates_presence_of
:project
validates_presence_of
:project
...
@@ -40,6 +41,10 @@ class Note < ActiveRecord::Base
...
@@ -40,6 +41,10 @@ class Note < ActiveRecord::Base
def
notify
def
notify
@notify
||=
false
@notify
||=
false
end
end
def
notify_author
@notify_author
||=
false
end
end
end
# == Schema Information
# == Schema Information
#
#
...
...
app/views/notes/_form.html.haml
View file @
53ce00f7
...
@@ -23,9 +23,13 @@
...
@@ -23,9 +23,13 @@
%br
%br
=
f
.
file_field
:attachment
=
f
.
file_field
:attachment
=
check_box_tag
:notify
,
1
,
true
=
check_box_tag
:notify
,
1
,
@note
.
noteable_type
!=
"Commit"
=
label_tag
:notify
,
"Notify project team about your note"
=
label_tag
:notify
,
"Notify project team about your note"
-
if
@note
.
noteable_type
==
"Commit"
=
check_box_tag
:notify_author
,
1
,
@note
.
noteable_type
==
"Commit"
=
label_tag
:notify_author
,
"Notify commit author about your note"
.clear
.clear
%br
%br
=
f
.
submit
'Add note'
,
:class
=>
"grey-button"
,
:id
=>
"submit_note"
=
f
.
submit
'Add note'
,
:class
=>
"grey-button"
,
:id
=>
"submit_note"
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