diff options
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/base_service.rb | 19 | ||||
-rw-r--r-- | app/services/issues/bulk_update_service.rb | 24 | ||||
-rw-r--r-- | app/services/issues/close_service.rb | 20 | ||||
-rw-r--r-- | app/services/issues/create_service.rb | 19 | ||||
-rw-r--r-- | app/services/issues/reopen_service.rb | 20 | ||||
-rw-r--r-- | app/services/issues/update_service.rb | 47 |
6 files changed, 0 insertions, 149 deletions
diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb deleted file mode 100644 index c3ca04a4343..00000000000 --- a/app/services/issues/base_service.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Issues - class BaseService < ::IssuableBaseService - - def hook_data(issue, action) - issue_data = issue.to_hook_data(current_user) - issue_url = Gitlab::UrlBuilder.new(:issue).build(issue.id) - issue_data[:object_attributes].merge!(url: issue_url, action: action) - issue_data - end - - private - - def execute_hooks(issue, action = 'open') - issue_data = hook_data(issue, action) - issue.project.execute_hooks(issue_data, :issue_hooks) - issue.project.execute_services(issue_data, :issue_hooks) - end - end -end diff --git a/app/services/issues/bulk_update_service.rb b/app/services/issues/bulk_update_service.rb deleted file mode 100644 index eb07413ee94..00000000000 --- a/app/services/issues/bulk_update_service.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Issues - class BulkUpdateService < BaseService - def execute - issues_ids = params.delete(:issues_ids).split(",") - issue_params = params - - issue_params.delete(:state_event) unless issue_params[:state_event].present? - issue_params.delete(:milestone_id) unless issue_params[:milestone_id].present? - issue_params.delete(:assignee_id) unless issue_params[:assignee_id].present? - - issues = Issue.where(id: issues_ids) - issues.each do |issue| - next unless can?(current_user, :modify_issue, issue) - - Issues::UpdateService.new(issue.project, current_user, issue_params).execute(issue) - end - - { - count: issues.count, - success: !issues.count.zero? - } - end - end -end diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb deleted file mode 100644 index f670019cc63..00000000000 --- a/app/services/issues/close_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Issues - class CloseService < Issues::BaseService - def execute(issue, commit = nil) - if issue.close - event_service.close_issue(issue, current_user) - create_note(issue, commit) - notification_service.close_issue(issue, current_user) - execute_hooks(issue, 'close') - end - - issue - end - - private - - def create_note(issue, current_commit) - Note.create_status_change_note(issue, issue.project, current_user, issue.state, current_commit) - end - end -end diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb deleted file mode 100644 index d5c17906a55..00000000000 --- a/app/services/issues/create_service.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Issues - class CreateService < Issues::BaseService - def execute - label_params = params[:label_ids] - issue = project.issues.new(params.except(:label_ids)) - issue.author = current_user - - if issue.save - issue.update_attributes(label_ids: label_params) - notification_service.new_issue(issue, current_user) - event_service.open_issue(issue, current_user) - issue.create_cross_references!(issue.project, current_user) - execute_hooks(issue, 'open') - end - - issue - end - end -end diff --git a/app/services/issues/reopen_service.rb b/app/services/issues/reopen_service.rb deleted file mode 100644 index 1e5c398516d..00000000000 --- a/app/services/issues/reopen_service.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Issues - class ReopenService < Issues::BaseService - def execute(issue) - if issue.reopen - event_service.reopen_issue(issue, current_user) - create_note(issue) - notification_service.reopen_issue(issue, current_user) - execute_hooks(issue, 'reopen') - end - - issue - end - - private - - def create_note(issue) - Note.create_status_change_note(issue, issue.project, current_user, issue.state, nil) - end - end -end diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb deleted file mode 100644 index 8f04a69287a..00000000000 --- a/app/services/issues/update_service.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Issues - class UpdateService < Issues::BaseService - def execute(issue) - state = params[:state_event] - - case state - when 'reopen' - Issues::ReopenService.new(project, current_user, {}).execute(issue) - when 'close' - Issues::CloseService.new(project, current_user, {}).execute(issue) - when 'task_check' - issue.update_nth_task(params[:task_num].to_i, true) - when 'task_uncheck' - issue.update_nth_task(params[:task_num].to_i, false) - end - - params[:assignee_id] = "" if params[:assignee_id] == IssuableFinder::NONE - params[:milestone_id] = "" if params[:milestone_id] == IssuableFinder::NONE - - old_labels = issue.labels.to_a - - if params.present? && issue.update_attributes(params.except(:state_event, - :task_num)) - issue.reset_events_cache - - if issue.labels != old_labels - create_labels_note( - issue, issue.labels - old_labels, old_labels - issue.labels) - end - - if issue.previous_changes.include?('milestone_id') - create_milestone_note(issue) - end - - if issue.previous_changes.include?('assignee_id') - create_assignee_note(issue) - notification_service.reassigned_issue(issue, current_user) - end - - issue.notice_added_references(issue.project, current_user) - execute_hooks(issue, 'update') - end - - issue - end - end -end |