From 1c463586c4b1aa39f8c55ec7de684faa13aa5d8b Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Thu, 18 May 2017 22:35:38 +0100 Subject: [PATCH] Removed un-used CSS Fixed random if statement [ci skip] --- .../javascripts/issue_show/components/app.vue | 5 +++-- .../issue_show/components/fields/project_move.vue | 1 - spec/javascripts/issue_show/components/app_spec.js | 13 +++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index 2a7a7d3900e..c4154745bf8 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -8,6 +8,7 @@ import Store from '../stores'; import titleComponent from './title.vue'; import descriptionComponent from './description.vue'; import formComponent from './form.vue'; +import '../../lib/utils/url_utility'; export default { props: { @@ -106,8 +107,8 @@ export default { .then((data) => { if (location.pathname !== data.path) { gl.utils.visitUrl(data.path); - } if (data.confidential !== this.isConfidential) { - gl.utils.visitUrl(location.href); + } else if (data.confidential !== this.isConfidential) { + gl.utils.visitUrl(location.pathname); } eventHub.$emit('close.form'); diff --git a/app/assets/javascripts/issue_show/components/fields/project_move.vue b/app/assets/javascripts/issue_show/components/fields/project_move.vue index 701c7f0ea9b..f811fb0de24 100644 --- a/app/assets/javascripts/issue_show/components/fields/project_move.vue +++ b/app/assets/javascripts/issue_show/components/fields/project_move.vue @@ -72,7 +72,6 @@ { json() { return { confidential: true, + path: location.pathname, }; }, }); @@ -126,7 +127,7 @@ describe('Issuable output', () => { setTimeout(() => { expect( gl.utils.visitUrl, - ).toHaveBeenCalledWith(location.href); + ).toHaveBeenCalledWith(location.pathname); done(); }); @@ -154,7 +155,14 @@ describe('Issuable output', () => { it('does not redirect if issue has not moved', (done) => { spyOn(gl.utils, 'visitUrl'); spyOn(vm.service, 'updateIssuable').and.callFake(() => new Promise((resolve) => { - resolve(); + resolve({ + json() { + return { + path: location.pathname, + confidential: vm.isConfidential, + }; + }, + }); })); vm.updateIssuable(); @@ -175,6 +183,7 @@ describe('Issuable output', () => { json() { return { path: '/testing-issue-move', + confidential: vm.isConfidential, }; }, });