Commit f5e24b32 authored by Igor Drozdov's avatar Igor Drozdov

Display base diff for merged merge requests

It should stay so until merge ref diff is persisted in the database
parent babfbe0f
...@@ -972,7 +972,7 @@ class MergeRequest < ApplicationRecord ...@@ -972,7 +972,7 @@ class MergeRequest < ApplicationRecord
# rubocop: enable CodeReuse/ServiceClass # rubocop: enable CodeReuse/ServiceClass
def diffable_merge_ref? def diffable_merge_ref?
merge_ref_head.present? && (Feature.enabled?(:display_merge_conflicts_in_diff, project) || can_be_merged?) open? && merge_ref_head.present? && (Feature.enabled?(:display_merge_conflicts_in_diff, project) || can_be_merged?)
end end
# Returns boolean indicating the merge_status should be rechecked in order to # Returns boolean indicating the merge_status should be rechecked in order to
......
...@@ -4275,6 +4275,14 @@ RSpec.describe MergeRequest, factory_default: :keep do ...@@ -4275,6 +4275,14 @@ RSpec.describe MergeRequest, factory_default: :keep do
expect(subject.diffable_merge_ref?).to eq(true) expect(subject.diffable_merge_ref?).to eq(true)
end end
context 'merge request is merged' do
subject { build_stubbed(:merge_request, :merged, project: project) }
it 'returns false' do
expect(subject.diffable_merge_ref?).to eq(false)
end
end
context 'merge request cannot be merged' do context 'merge request cannot be merged' do
before do before do
subject.mark_as_unchecked! subject.mark_as_unchecked!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment