diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 21:09:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-12 21:09:21 +0300 |
commit | 43e3dc2f95a25c600e08f65d4f1c406a1a63ed3d (patch) | |
tree | db5c72020c7c8916020c8aff7c1b7128028d650b /app/presenters | |
parent | 2c89e169769ead722394a79ed67fcd08e96863dd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/snippet_blob_presenter.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/presenters/snippet_blob_presenter.rb b/app/presenters/snippet_blob_presenter.rb index 71361b18f5a..70a373619d6 100644 --- a/app/presenters/snippet_blob_presenter.rb +++ b/app/presenters/snippet_blob_presenter.rb @@ -1,16 +1,20 @@ # frozen_string_literal: true class SnippetBlobPresenter < BlobPresenter - def highlighted_data + def rich_data return if blob.binary? - highlight(plain: false) + if markup? + blob.rendered_markup + else + highlight(plain: false) + end end - def plain_highlighted_data + def plain_data return if blob.binary? - highlight(plain: true) + highlight(plain: !markup?) end def raw_path @@ -23,6 +27,10 @@ class SnippetBlobPresenter < BlobPresenter private + def markup? + blob.rich_viewer&.partial_name == 'markup' + end + def snippet blob.snippet end |