Alert commit author on note
Allows to alert only the commit author when a new note is added on a commit, useful when gitlabhq is used for code reviews, allows less noise with mails...
This commit is contained in:
parent
89a43543e9
commit
c0b47d3245
5 changed files with 13 additions and 2 deletions
|
@ -27,7 +27,7 @@ class MailerObserver < ActiveRecord::Observer
|
|||
end
|
||||
|
||||
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|
|
||||
case note.noteable_type
|
||||
when "Commit" then
|
||||
|
|
|
@ -14,6 +14,7 @@ class Note < ActiveRecord::Base
|
|||
|
||||
attr_protected :author, :author_id
|
||||
attr_accessor :notify
|
||||
attr_accessor :notify_author
|
||||
|
||||
validates_presence_of :project
|
||||
|
||||
|
@ -40,6 +41,10 @@ class Note < ActiveRecord::Base
|
|||
def notify
|
||||
@notify ||= false
|
||||
end
|
||||
|
||||
def notify_author
|
||||
@notify_author ||= false
|
||||
end
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue