diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 15:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-14 15:09:34 +0300 |
commit | 9a5dcad39c5dd81384ae4ec2398435883b944363 (patch) | |
tree | 3c684d30e4500028299d7948171e885b844a1ade /app/assets/javascripts/vue_shared/components/file_row.vue | |
parent | 0923a94d58cdd15cdb6379330e5eb41d30ccb8cc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/file_row.vue')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/file_row.vue | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/assets/javascripts/vue_shared/components/file_row.vue b/app/assets/javascripts/vue_shared/components/file_row.vue index 004bf882dd6..c1c4f437dee 100644 --- a/app/assets/javascripts/vue_shared/components/file_row.vue +++ b/app/assets/javascripts/vue_shared/components/file_row.vue @@ -14,6 +14,11 @@ export default { type: Object, required: true, }, + fileUrl: { + type: String, + required: false, + default: '', + }, level: { type: Number, required: true, @@ -48,6 +53,9 @@ export default { // don't output a title if we don't have the expanded path return this.file?.tree?.length ? this.file.tree[0].parentPath : false; }, + fileRouterUrl() { + return this.fileUrl || `/project${this.file.url}`; + }, }, watch: { 'file.active': function fileActiveWatch(active) { @@ -74,7 +82,7 @@ export default { this.toggleTreeOpen(this.file.path); } - if (this.$router) this.$router.push(`/project${this.file.url}`); + if (this.$router && !this.hasUrlAtCurrentRoute()) this.$router.push(this.fileRouterUrl); if (this.isBlob) this.clickedFile(this.file.path); }, @@ -104,7 +112,7 @@ export default { hasUrlAtCurrentRoute() { if (!this.$router || !this.$router.currentRoute) return true; - return this.$router.currentRoute.path === `/project${escapeFileUrl(this.file.url)}`; + return this.$router.currentRoute.path === escapeFileUrl(this.fileRouterUrl); }, }, }; |