Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2019-01-31 11:58:23 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2019-02-04 14:48:35 +0300
commitb2c70230b35e72826f55acfd6b44bfabd19302bb (patch)
tree66d214c65e256034f53c4497c5b65fbd9c8494df /app/services
parentb9f0eff9fc72e891e2ccf910b3fcd52539bc48fb (diff)
Remove Redcarpet markdown engine
This engine was replaced with CommonMarker in 11.4, it was deprecated since then.
Diffstat (limited to 'app/services')
-rw-r--r--app/services/issuable_base_service.rb4
-rw-r--r--app/services/preview_markdown_service.rb11
-rw-r--r--app/services/task_list_toggle_service.rb23
3 files changed, 7 insertions, 31 deletions
diff --git a/app/services/issuable_base_service.rb b/app/services/issuable_base_service.rb
index 842d59d26a0..ef991eaf234 100644
--- a/app/services/issuable_base_service.rb
+++ b/app/services/issuable_base_service.rb
@@ -270,9 +270,7 @@ class IssuableBaseService < BaseService
tasklist_toggler = TaskListToggleService.new(issuable.description, issuable.description_html,
line_source: update_task_params[:line_source],
line_number: update_task_params[:line_number].to_i,
- toggle_as_checked: update_task_params[:checked],
- index: update_task_params[:index].to_i,
- sourcepos: !issuable.legacy_markdown?)
+ toggle_as_checked: update_task_params[:checked])
unless tasklist_toggler.execute
# if we make it here, the data is much newer than we thought it was - fail fast
diff --git a/app/services/preview_markdown_service.rb b/app/services/preview_markdown_service.rb
index a449a5dc3e9..c1655c38095 100644
--- a/app/services/preview_markdown_service.rb
+++ b/app/services/preview_markdown_service.rb
@@ -10,8 +10,7 @@ class PreviewMarkdownService < BaseService
text: text,
users: users,
suggestions: suggestions,
- commands: commands.join(' '),
- markdown_engine: markdown_engine
+ commands: commands.join(' ')
)
end
@@ -49,12 +48,4 @@ class PreviewMarkdownService < BaseService
def commands_target_id
params[:quick_actions_target_id]
end
-
- def markdown_engine
- if params[:legacy_render]
- :redcarpet
- else
- CacheMarkdownField::MarkdownEngine.from_version(params[:markdown_version].to_i)
- end
- end
end
diff --git a/app/services/task_list_toggle_service.rb b/app/services/task_list_toggle_service.rb
index 2717fc9035a..b5c4cd3235d 100644
--- a/app/services/task_list_toggle_service.rb
+++ b/app/services/task_list_toggle_service.rb
@@ -5,17 +5,13 @@
# We don't care if the text has changed above or below the specific checkbox, as long
# the checkbox still exists at exactly the same line number and the text is equal.
# If successful, new values are available in `updated_markdown` and `updated_markdown_html`
-#
-# Note: once we've removed RedCarpet support, we can remove the `index` and `sourcepos`
-# parameters
class TaskListToggleService
attr_reader :updated_markdown, :updated_markdown_html
- def initialize(markdown, markdown_html, line_source:, line_number:, toggle_as_checked:, index:, sourcepos: true)
+ def initialize(markdown, markdown_html, line_source:, line_number:, toggle_as_checked:)
@markdown, @markdown_html = markdown, markdown_html
@line_source, @line_number = line_source, line_number
@toggle_as_checked = toggle_as_checked
- @index, @use_sourcepos = index, sourcepos
@updated_markdown, @updated_markdown_html = nil
end
@@ -28,8 +24,8 @@ class TaskListToggleService
private
- attr_reader :markdown, :markdown_html, :index, :toggle_as_checked
- attr_reader :line_source, :line_number, :use_sourcepos
+ attr_reader :markdown, :markdown_html, :toggle_as_checked
+ attr_reader :line_source, :line_number
def toggle_markdown
source_lines = markdown.split("\n")
@@ -68,17 +64,8 @@ class TaskListToggleService
end
# When using CommonMark, we should be able to use the embedded `sourcepos` attribute to
- # target the exact line in the DOM. For RedCarpet, we need to use the index of the checkbox
- # that was checked and match it with what we think is the same checkbox.
- # The reason `sourcepos` is slightly more reliable is the case where a line of text is
- # changed from a regular line into a checkbox (or vice versa). Then the checked index
- # in the UI will be off from the list of checkboxes we've calculated locally.
- # It's a rare circumstance, but since we can account for it, we do.
+ # target the exact line in the DOM.
def get_html_checkbox(html)
- if use_sourcepos
- html.css(".task-list-item[data-sourcepos^='#{line_number}:'] > input.task-list-item-checkbox").first
- else
- html.css('.task-list-item-checkbox')[index - 1]
- end
+ html.css(".task-list-item[data-sourcepos^='#{line_number}:'] > input.task-list-item-checkbox").first
end
end