diff options
Diffstat (limited to 'app/controllers/projects/blob_controller.rb')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index c02ec407262..0718658cd48 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -122,7 +122,7 @@ class Projects::BlobController < Projects::ApplicationController @lines.map! do |line| # These are marked as context lines but are loaded from blobs. # We also have context lines loaded from diffs in other places. - diff_line = Gitlab::Diff::Line.new(line, 'context', nil, nil, nil) + diff_line = Gitlab::Diff::Line.new(line, expanded_diff_line_type, nil, nil, nil) diff_line.rich_text = line diff_line end @@ -132,6 +132,11 @@ class Projects::BlobController < Projects::ApplicationController render json: DiffLineSerializer.new.represent(@lines) end + def expanded_diff_line_type + # Context lines can't receive comments. + Feature.enabled?(:comment_in_any_diff_line, @project) ? nil : 'context' + end + def add_match_line return unless @form.unfold? |