Commit 98b921bd authored by Donald Cook's avatar Donald Cook Committed by Natalia Tepluhina

Updated redirect logic to not take route changes into account

parent 3aeef74f
......@@ -295,7 +295,7 @@ export default {
.then(res => res.data)
.then(data => this.checkForSpam(data))
.then(data => {
if (window.location.pathname !== data.web_url) {
if (!window.location.pathname.includes(data.web_url)) {
visitUrl(data.web_url);
}
})
......
......@@ -221,6 +221,19 @@ describe('Issuable output', () => {
});
});
it('does not redirect if issue has not moved and user has switched tabs', () => {
jest.spyOn(vm.service, 'updateIssuable').mockResolvedValue({
data: {
web_url: '',
confidential: vm.isConfidential,
},
});
return vm.updateIssuable().then(() => {
expect(visitUrl).not.toHaveBeenCalled();
});
});
it('redirects if returned web_url has changed', () => {
jest.spyOn(vm.service, 'updateIssuable').mockResolvedValue({
data: {
......
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