GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit 6f7a3ee6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor merge request version compare feature

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 5f0535ac
......@@ -542,7 +542,7 @@ def build_merge_request
end
def compared_diff_version
compare = CompareService.new.execute(@project, @merge_request_diff.head_commit_sha, @project, @start_sha)
compare = @merge_request_diff.compare_with(@start_sha)
if compare
@diffs = compare.diffs(diff_options)
......@@ -551,11 +551,7 @@ def compared_diff_version
end
def original_diff_version
unless @merge_request_diff.latest?
# Disable comments if browsing older version of the diff
@diff_notes_disabled = true
end
@diff_notes_disabled = !@merge_request_diff.latest?
@diffs = @merge_request_diff.diffs(diff_options)
end
end
......@@ -152,6 +152,10 @@ def latest?
self == merge_request.merge_request_diff
end
def compare_with(sha)
CompareService.new.execute(project, head_commit_sha, project, sha)
end
private
def dump_commits(commits)
......
......@@ -24,7 +24,7 @@
= time_ago_with_tooltip(merge_request_diff.created_at)
- if @merge_request_diff.base_commit_sha
&nbsp;and&nbsp;
and
%span.dropdown.inline.mr-version-compare-dropdown
%a.btn-link.dropdown-toggle{ data: {toggle: :dropdown} }
%strong
......@@ -51,8 +51,10 @@
#{@merge_request.target_branch} (base)
.monospace #{short_sha(@merge_request_diff.base_commit_sha)}
- unless @merge_request_diff.latest? && !@start_sha
.prepend-top-10
= icon('info-circle')
Comments are disabled while viewing outdated merge versions or comparing to versions other than base.
- if @start_sha
Comments are disabled because you're comparing two versions of this merge request.
- else
Comments are disabled because you're viewing an old version of this merge request.
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