diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 18:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 18:06:16 +0300 |
commit | b1d7b01241da7f7f5d42c5ef46c7788fac0ab6d3 (patch) | |
tree | b53def1340801c2b7706e9f68f6b17a36efad4dd /app/services/boards/lists | |
parent | aabf412bc1f30cb12d97a077458d002c57cad8e9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/boards/lists')
-rw-r--r-- | app/services/boards/lists/create_service.rb | 6 | ||||
-rw-r--r-- | app/services/boards/lists/update_service.rb | 16 |
2 files changed, 17 insertions, 5 deletions
diff --git a/app/services/boards/lists/create_service.rb b/app/services/boards/lists/create_service.rb index eb417ac4f5f..6f9a063cb16 100644 --- a/app/services/boards/lists/create_service.rb +++ b/app/services/boards/lists/create_service.rb @@ -43,7 +43,11 @@ module Boards end def create_list(board, type, target, position) - board.lists.create(type => target, list_type: type, position: position) + board.lists.create(create_list_attributes(type, target, position)) + end + + def create_list_attributes(type, target, position) + { type => target, list_type: type, position: position } end end end diff --git a/app/services/boards/lists/update_service.rb b/app/services/boards/lists/update_service.rb index ad96e42f756..4a463372c82 100644 --- a/app/services/boards/lists/update_service.rb +++ b/app/services/boards/lists/update_service.rb @@ -4,16 +4,22 @@ module Boards module Lists class UpdateService < Boards::BaseService def execute(list) - update_preferences_result = update_preferences(list) if can_read?(list) - update_position_result = update_position(list) if can_admin?(list) - - if update_preferences_result || update_position_result + if execute_by_params(list) success(list: list) else error(list.errors.messages, 422) end end + private + + def execute_by_params(list) + update_preferences_result = update_preferences(list) if can_read?(list) + update_position_result = update_position(list) if can_admin?(list) + + update_preferences_result || update_position_result + end + def update_preferences(list) return unless preferences? @@ -50,3 +56,5 @@ module Boards end end end + +Boards::Lists::UpdateService.prepend_if_ee('EE::Boards::Lists::UpdateService') |