summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/merge_request_diff.rb4
-rw-r--r--app/views/projects/merge_requests/show/_versions.html.haml8
2 files changed, 8 insertions, 4 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 074d8f5d40a..24e09c4d57c 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -30,6 +30,10 @@ class MergeRequestDiff < ActiveRecord::Base
# It allows you to override variables like head_commit_sha before getting diff.
after_create :save_git_content, unless: :importing?
+ def self.select_without_diff
+ select(column_names - ['st_diffs'])
+ end
+
# Collect information about commits and diff from repository
# and save it to the database as serialized data
def save_git_content
diff --git a/app/views/projects/merge_requests/show/_versions.html.haml b/app/views/projects/merge_requests/show/_versions.html.haml
index 93a06154022..84c2b83e330 100644
--- a/app/views/projects/merge_requests/show/_versions.html.haml
+++ b/app/views/projects/merge_requests/show/_versions.html.haml
@@ -1,7 +1,7 @@
-- diffs_count = @merge_request.merge_request_diffs.count
+- merge_request_diffs = @merge_request.merge_request_diffs.select_without_diff
+- latest_diff = merge_request_diffs.first
-- if diffs_count > 1
- - latest_diff = @merge_request.merge_request_diff
+- if merge_request_diffs.size > 1
.mr-version-switch
Version:&nbsp;
%span.dropdown.inline
@@ -13,7 +13,7 @@
#{@merge_request_diff.head_commit.short_id}
%span.caret
%ul.dropdown-menu.dropdown-menu-selectable
- - @merge_request.merge_request_diffs.each do |merge_request_diff|
+ - merge_request_diffs.each do |merge_request_diff|
%li
= link_to diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request, diff_id: merge_request_diff.id), class: ('is-active' if merge_request_diff == @merge_request_diff) do
%strong.monospace