diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 15:10:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-27 15:10:12 +0300 |
commit | 154523302b10ab5aeb67bde861880a98e3f8117a (patch) | |
tree | 3b399e7da80ccc47877c5b6e1491abdcf1019c1b /app/services/boards | |
parent | 018e39a9507cc12bee5c6a168641d9843c5a6419 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/boards')
-rw-r--r-- | app/services/boards/lists/base_update_service.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/services/boards/lists/base_update_service.rb b/app/services/boards/lists/base_update_service.rb index faf58e405fc..bcb7d6c8504 100644 --- a/app/services/boards/lists/base_update_service.rb +++ b/app/services/boards/lists/base_update_service.rb @@ -3,16 +3,30 @@ module Boards module Lists class BaseUpdateService < Boards::BaseService + extend ::Gitlab::Utils::Override + def execute(list) if execute_by_params(list) success(list: list) else - error(list.errors.messages, 422) + message = list.errors.empty? ? 'The update was not successful.' : list.errors.messages + + error(message, { list: list }) end end private + override :error + def error(message, pass_back = {}) + ServiceResponse.error(message: message, http_status: :unprocessable_entity, payload: pass_back) + end + + override :success + def success(pass_back = {}) + ServiceResponse.success(payload: pass_back) + end + 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) |