| ... | @@ -12,10 +12,8 @@ class NotesController < ApplicationController |
... | @@ -12,10 +12,8 @@ class NotesController < ApplicationController |
|
|
def create
|
|
def create
|
|
|
@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'
|
|
|
if @note.save
|
|
@note.save
|
|
|
notify if params[:notify] == '1'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
respond_to do |format|
|
|
|
format.html {redirect_to :back}
|
|
format.html {redirect_to :back}
|
| ... | @@ -35,22 +33,4 @@ class NotesController < ApplicationController |
... | @@ -35,22 +33,4 @@ class NotesController < ApplicationController |
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
|
|
def notify
|
|
|
|
|
@project.users.reject { |u| u.id == current_user.id } .each do |u|
|
|
|
|
|
case @note.noteable_type
|
|
|
|
|
when "Commit" then
|
|
|
|
|
Notify.note_commit_email(u, @note).deliver
|
|
|
|
|
when "Issue" then
|
|
|
|
|
Notify.note_issue_email(u, @note).deliver
|
|
|
|
|
when "MergeRequest"
|
|
|
|
|
true # someone should write email notification
|
|
|
|
|
when "Snippet"
|
|
|
|
|
true
|
|
|
|
|
else
|
|
|
|
|
Notify.note_wall_email(u, @note).deliver
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end |
|
end |