debian-mirror-gitlab/app/services/boards/issues/create_service.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2016-11-03 12:29:30 +05:30
module Boards
module Issues
2018-03-17 18:26:18 +05:30
class CreateService < Boards::BaseService
attr_accessor :project
def initialize(parent, project, user, params = {})
@project = project
super(parent, user, params)
end
2016-11-03 12:29:30 +05:30
def execute
2018-11-08 19:23:39 +05:30
create_issue(params.merge(issue_params))
2016-11-03 12:29:30 +05:30
end
private
2018-11-08 19:23:39 +05:30
def issue_params
{ label_ids: [list.label_id] }
end
2016-11-03 12:29:30 +05:30
def board
2018-03-17 18:26:18 +05:30
@board ||= parent.boards.find(params.delete(:board_id))
2016-11-03 12:29:30 +05:30
end
def list
@list ||= board.lists.find(params.delete(:list_id))
end
def create_issue(params)
2021-09-30 23:02:18 +05:30
# NOTE: We are intentionally not doing a spam/CAPTCHA check for issues created via boards.
# See https://gitlab.com/gitlab-org/gitlab/-/issues/29400#note_598479184 for more context.
2023-04-23 21:23:45 +05:30
::Issues::CreateService.new(container: project, current_user: current_user, params: params, spam_params: nil).execute
2016-11-03 12:29:30 +05:30
end
end
end
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
Boards::Issues::CreateService.prepend_mod_with('Boards::Issues::CreateService')