Class: Boards::Lists::ListService

Inherits:
BaseService show all
Defined in:
app/services/boards/lists/list_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #parent

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

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 Boards::BaseService

Instance Method Details

#execute(board, create_default_lists: true) ⇒ Object


6
7
8
9
10
11
12
13
# File 'app/services/boards/lists/list_service.rb', line 6

def execute(board, create_default_lists: true)
  if create_default_lists && !board.lists.backlog.exists?
    board.lists.create(list_type: :backlog)
  end

  lists = board.lists.preload_associated_models
  params[:list_id].present? ? lists.where(id: params[:list_id]) : lists # rubocop: disable CodeReuse/ActiveRecord
end