From 8aedb71c4900021ca74e188873278ac40356f40e Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Wed, 3 Oct 2018 20:14:39 +0200 Subject: [PATCH] Fix showing diff file header for renamed files --- .../diffs/components/diff_file_header.vue | 10 +- .../notes/components/diff_file_header.vue | 94 ------------------- app/serializers/diff_file_entity.rb | 2 +- .../unreleased/_acet-fix-diff-file-header.yml | 5 + spec/javascripts/diffs/mock_data/diff_file.js | 2 +- 5 files changed, 11 insertions(+), 102 deletions(-) delete mode 100644 app/assets/javascripts/notes/components/diff_file_header.vue create mode 100644 changelogs/unreleased/_acet-fix-diff-file-header.yml diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 517fbf400e8..15b37243030 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -166,18 +166,16 @@ export default { :title="diffFile.oldPath" class="file-title-name" data-container="body" - > - {{ diffFile.oldPath }} - + v-html="diffFile.oldPathHtml" + > → - {{ diffFile.newPath }} - + v-html="diffFile.newPathHtml" + > -import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; -import Icon from '~/vue_shared/components/icon.vue'; - -export default { - components: { - ClipboardButton, - Icon, - }, - props: { - diffFile: { - type: Object, - required: true, - }, - }, - computed: { - titleTag() { - return this.diffFile.discussionPath ? 'a' : 'span'; - }, - }, -}; - - - diff --git a/app/serializers/diff_file_entity.rb b/app/serializers/diff_file_entity.rb index cbe6f200b86..c193ed10fef 100644 --- a/app/serializers/diff_file_entity.rb +++ b/app/serializers/diff_file_entity.rb @@ -84,7 +84,7 @@ class DiffFileEntity < Grape::Entity end expose :old_path_html do |diff_file| - old_path = mark_inline_diffs(diff_file.old_path, diff_file.new_path) + old_path, _ = mark_inline_diffs(diff_file.old_path, diff_file.new_path) old_path end diff --git a/changelogs/unreleased/_acet-fix-diff-file-header.yml b/changelogs/unreleased/_acet-fix-diff-file-header.yml new file mode 100644 index 00000000000..2fb3293072d --- /dev/null +++ b/changelogs/unreleased/_acet-fix-diff-file-header.yml @@ -0,0 +1,5 @@ +--- +title: Fix showing diff file header for renamed files +merge_request: 22089 +author: +type: fixed diff --git a/spec/javascripts/diffs/mock_data/diff_file.js b/spec/javascripts/diffs/mock_data/diff_file.js index 372b8f066cf..2aa2f8f3528 100644 --- a/spec/javascripts/diffs/mock_data/diff_file.js +++ b/spec/javascripts/diffs/mock_data/diff_file.js @@ -33,7 +33,7 @@ export default { contentSha: 'c48ee0d1bf3b30453f5b32250ce03134beaa6d13', storedExternally: null, externalStorage: null, - oldPathHtml: ['CHANGELOG', 'CHANGELOG'], + oldPathHtml: 'CHANGELOG', newPathHtml: 'CHANGELOG', editPath: '/gitlab-org/gitlab-test/edit/spooky-stuff/CHANGELOG', viewPath: '/gitlab-org/gitlab-test/blob/spooky-stuff/CHANGELOG',