diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-07-22 13:25:24 +0800 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-07-22 13:25:24 +0800 |
commit | 866bef8059591db9a17db71d66a1321b0ca25153 (patch) | |
tree | 84dcaf3f611c769c5676220040d163374fbcd3f0 /app/presenters/blob_presenter.rb | |
parent | bf172b115c206cb6ed6c2b271fad600f1548b43c (diff) | |
download | gitlab-ce-866bef8059591db9a17db71d66a1321b0ca25153.tar.gz |
Fix suggestion on lines that are not part of an MR57953-fix-unfolded-diff-suggestions
Return the `text` as plain string in the response instead of
including HTML tags but keep `rich_text` as is.
The fix is to modify `Blob::UnfoldPresenter#diff_files` to map
each raw diff line (limited by the range specified) to a
corresponding line in an array of highlighted lines to use as
`rich_text`.
Diffstat (limited to 'app/presenters/blob_presenter.rb')
-rw-r--r-- | app/presenters/blob_presenter.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb index 91c9abe750b..2cf3278d240 100644 --- a/app/presenters/blob_presenter.rb +++ b/app/presenters/blob_presenter.rb @@ -4,7 +4,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated presents :blob def highlight(plain: nil) - blob.load_all_data! if blob.respond_to?(:load_all_data!) + load_all_blob_data Gitlab::Highlight.highlight( blob.path, @@ -17,4 +17,10 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated def web_url Gitlab::Routing.url_helpers.project_blob_url(blob.repository.project, File.join(blob.commit_id, blob.path)) end + + private + + def load_all_blob_data + blob.load_all_data! if blob.respond_to?(:load_all_data!) + end end |