diff options
author | Brett Walker <bwalker@gitlab.com> | 2019-01-24 16:13:35 -0600 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-01-30 23:18:18 +0100 |
commit | b119fcb2e49289d26042e559d37fbfae58ac1536 (patch) | |
tree | 791a5a49b9947ab5e7cc66c7547ec291d3f3040e /app/services/issues | |
parent | e42d95fb9e412388eb3215dff674e05c73d65977 (diff) | |
download | gitlab-ce-b119fcb2e49289d26042e559d37fbfae58ac1536.tar.gz |
Refactor and added specs
Diffstat (limited to 'app/services/issues')
-rw-r--r-- | app/services/issues/update_service.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index cf6173da8d4..9c7b8fcc6ab 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -129,17 +129,17 @@ module Issues update_task_params = params.delete(:update_task) return unless update_task_params - updated_content = Taskable.toggle_task(issue.description, issue.description_html, - index: update_task_params[:index], - currently_checked: !update_task_params[:checked], - line_source: update_task_params[:line_source], - line_number: update_task_params[:line_number]) + toggler = TaskListToggleService.new(issue.description, issue.description_html, + index: update_task_params[:index], + currently_checked: !update_task_params[:checked], + line_source: update_task_params[:line_source], + line_number: update_task_params[:line_number]) - unless updated_content.empty? + if toggler.execute # by updating the description_html field at the same time, # the markdown cache won't be considered invalid - params[:description] = updated_content[:content] - params[:description_html] = updated_content[:content_html] + params[:description] = toggler.updated_markdown + params[:description_html] = toggler.updated_markdown_html # since we're updating a very specific line, we don't care whether # the `lock_version` sent from the FE is the same or not. Just |