Class: DraftNotes::DestroyService

Inherits:
BaseService show all
Defined in:
app/services/draft_notes/destroy_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #merge_request, #params

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize, #merge_request_activity_counter

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from DraftNotes::BaseService

Instance Method Details

#execute(draft = nil) ⇒ Object

If no ‘draft` is given it fallsback to all draft notes of the given merge request and user.



7
8
9
10
11
12
13
# File 'app/services/draft_notes/destroy_service.rb', line 7

def execute(draft = nil)
  drafts = draft || draft_notes

  clear_highlight_diffs_cache(Array.wrap(drafts))

  drafts.is_a?(DraftNote) ? drafts.destroy! : drafts.delete_all
end