module Api
class NotesController < ApiController
- layout "site", :only => [:mine]
-
before_action :check_api_readable
before_action :setup_user_auth, :only => [:create, :comment, :show]
before_action :authorize, :only => [:close, :reopen, :destroy, :comment]
@note.status = "hidden"
@note.save
- add_comment(@note, comment, "hidden", false)
+ add_comment(@note, comment, "hidden", :notify => false)
end
# Return a copy of the updated note
##
# Add a comment to a note
- def add_comment(note, text, event, notify = true)
+ def add_comment(note, text, event, notify: true)
attributes = { :visible => true, :event => event, :body => text }
if current_user
comment = note.comments.create!(attributes)
note.comments.map(&:author).uniq.each do |user|
- Notifier.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible?
+ UserMailer.note_comment_notification(comment, user).deliver_later if notify && user && user != current_user && user.visible?
end
end
end