Commit 8aedb71c authored by Fatih Acet's avatar Fatih Acet

Fix showing diff file header for renamed files

parent e3b96ad7
...@@ -166,18 +166,16 @@ export default { ...@@ -166,18 +166,16 @@ export default {
:title="diffFile.oldPath" :title="diffFile.oldPath"
class="file-title-name" class="file-title-name"
data-container="body" data-container="body"
> v-html="diffFile.oldPathHtml"
{{ diffFile.oldPath }} ></strong>
</strong>
<strong <strong
v-tooltip v-tooltip
:title="diffFile.newPath" :title="diffFile.newPath"
class="file-title-name" class="file-title-name"
data-container="body" data-container="body"
> v-html="diffFile.newPathHtml"
{{ diffFile.newPath }} ></strong>
</strong>
</span> </span>
<strong <strong
......
<script>
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';
},
},
};
</script>
<template>
<div class="file-header-content">
<div
v-if="diffFile.submodule"
>
<span>
<icon name="archive" />
<strong
class="file-title-name"
v-html="diffFile.submoduleLink"
></strong>
<clipboard-button
:text="diffFile.submoduleLink"
title="Copy file path to clipboard"
css-class="btn-default btn-transparent btn-clipboard"
/>
</span>
</div>
<template v-else>
<component
:is="titleTag"
ref="titleWrapper"
:href="diffFile.discussionPath"
>
<span v-html="diffFile.blobIcon"></span>
<span v-if="diffFile.renamedFile">
<strong
:title="diffFile.oldPath"
class="file-title-name has-tooltip"
data-container="body"
>
{{ diffFile.oldPath }}
</strong>
&rarr;
<strong
:title="diffFile.newPath"
class="file-title-name has-tooltip"
data-container="body"
>
{{ diffFile.newPath }}
</strong>
</span>
<strong
v-else
:title="diffFile.oldPath"
class="file-title-name has-tooltip"
data-container="body"
>
{{ diffFile.filePath }}
<span v-if="diffFile.deletedFile">
deleted
</span>
</strong>
</component>
<clipboard-button
:text="diffFile.filePath"
title="Copy file path to clipboard"
css-class="btn-default btn-transparent btn-clipboard"
/>
<small
v-if="diffFile.modeChanged"
ref="fileMode"
>
{{ diffFile.aMode }}{{ diffFile.bMode }}
</small>
</template>
</div>
</template>
...@@ -84,7 +84,7 @@ class DiffFileEntity < Grape::Entity ...@@ -84,7 +84,7 @@ class DiffFileEntity < Grape::Entity
end end
expose :old_path_html do |diff_file| 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 old_path
end end
......
---
title: Fix showing diff file header for renamed files
merge_request: 22089
author:
type: fixed
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
contentSha: 'c48ee0d1bf3b30453f5b32250ce03134beaa6d13', contentSha: 'c48ee0d1bf3b30453f5b32250ce03134beaa6d13',
storedExternally: null, storedExternally: null,
externalStorage: null, externalStorage: null,
oldPathHtml: ['CHANGELOG', 'CHANGELOG'], oldPathHtml: 'CHANGELOG',
newPathHtml: 'CHANGELOG', newPathHtml: 'CHANGELOG',
editPath: '/gitlab-org/gitlab-test/edit/spooky-stuff/CHANGELOG', editPath: '/gitlab-org/gitlab-test/edit/spooky-stuff/CHANGELOG',
viewPath: '/gitlab-org/gitlab-test/blob/spooky-stuff/CHANGELOG', viewPath: '/gitlab-org/gitlab-test/blob/spooky-stuff/CHANGELOG',
......
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