From 93407c9723d2526205d345a3e9e12a4d2f92c8d6 Mon Sep 17 00:00:00 2001 From: Sameer Al-Sakran <salsakran@users.noreply.github.com> Date: Wed, 18 Jul 2018 10:04:52 -0700 Subject: [PATCH] =?UTF-8?q?change=20pulse=20urls=20to=20make=20sure=20a=20?= =?UTF-8?q?pulse=20in=20a=20collection=20links=20to=20the=20e=E2=80=A6=20(?= =?UTF-8?q?#8095)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Try wrapping setTimeout to check for closed window * change pulse urls to make sure a pulse in a collection links to the edit view instead of the list --- frontend/src/metabase/lib/urls.js | 2 +- frontend/test/__support__/integrated_tests.js | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/frontend/src/metabase/lib/urls.js b/frontend/src/metabase/lib/urls.js index cdf2397220c..80c6c5acdb3 100644 --- a/frontend/src/metabase/lib/urls.js +++ b/frontend/src/metabase/lib/urls.js @@ -74,7 +74,7 @@ export function modelToUrl(model, modelId) { } export function pulse(pulseId) { - return `/pulse/#${pulseId}`; + return `/pulse/${pulseId}`; } export function pulseEdit(pulseId) { diff --git a/frontend/test/__support__/integrated_tests.js b/frontend/test/__support__/integrated_tests.js index 754f82dea9e..b242270a8bf 100644 --- a/frontend/test/__support__/integrated_tests.js +++ b/frontend/test/__support__/integrated_tests.js @@ -1,3 +1,27 @@ +console.log("INIT!", new Error().stack); + +const _close = window.close; +window.close = function() { + console.log("CLOSE!", new Error().stack); + return _close.apply(this, arguments); +}; + +const _setTimeout = window.setTimeout; +window.setTimeout = function(fn, ...args) { + if (typeof fn === "function") { + const stack = new Error().stack; + const _fn = fn; + fn = function() { + if (!window.document) { + console.log("WINDOW CLOSED, SKIPPING TIMEOUT", stack); + // return; + } + return _fn.apply(this, arguments); + }; + } + return _setTimeout.call(this, fn, ...args); +}; + /* global process, jasmine */ /** -- GitLab