52967b107b
[10.6] Prevent notes on confidential issues from being sent to chat See merge request gitlab/gitlabhq!2366 # Conflicts: # app/helpers/services_helper.rb
33 lines
800 B
Ruby
33 lines
800 B
Ruby
module Notes
|
|
class PostProcessService
|
|
attr_accessor :note
|
|
|
|
def initialize(note)
|
|
@note = note
|
|
end
|
|
|
|
def execute
|
|
# Skip system notes, like status changes and cross-references and awards
|
|
unless @note.system?
|
|
EventCreateService.new.leave_note(@note, @note.author)
|
|
|
|
return unless @note.for_project_noteable?
|
|
|
|
@note.create_cross_references!
|
|
execute_note_hooks
|
|
end
|
|
end
|
|
|
|
def hook_data
|
|
Gitlab::DataBuilder::Note.build(@note, @note.author)
|
|
end
|
|
|
|
def execute_note_hooks
|
|
note_data = hook_data
|
|
hooks_scope = @note.confidential? ? :confidential_note_hooks : :note_hooks
|
|
|
|
@note.project.execute_hooks(note_data, hooks_scope)
|
|
@note.project.execute_services(note_data, hooks_scope)
|
|
end
|
|
end
|
|
end
|