From 053f22182a1a3d759cfa017ab9fff266da4a36f7 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 28 Sep 2018 11:57:36 -0700 Subject: [PATCH] fix inspection case --- scripts/system/marketplaces/marketplaces.js | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 03ce986821..cca535a064 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -101,11 +101,19 @@ function setupWallet(referrer) { } function onMarketplaceOpen(referrer) { + var cta = referrer, match; if (Account.loggedIn && walletNeedsSetup()) { - if (referrer) { - setupWallet(referrer); + if (referrer === MARKETPLACE_URL_INITIAL) { + setupWallet('marketplace cta'); } else { - print("WARNING: opening marketplace to", url, "without wallet setup."); + match = referrer.match(/\/item\/(\w+)$/); + if (match && match[1]) { + setupWallet(match[1]); + } else if (referrer.indexOf(METAVERSE_SERVER_URL) === -1) { // not a url + setupWallet(referrer); + } else { + print("WARNING: opening marketplace to", referrer, "without wallet setup."); + } } } } @@ -117,17 +125,9 @@ function openMarketplace(optionalItemOrUrl) { // Otherwise, use home and 'marketplace cta'. // AND... if call onMarketplaceOpen to setupWallet if we need to. var url = optionalItemOrUrl || MARKETPLACE_URL_INITIAL; - var cta = 'marketplace cta'; - var match; // If optionalItemOrUrl contains the metaverse base, then it's a url, not an item id. if (optionalItemOrUrl && optionalItemOrUrl.indexOf(METAVERSE_SERVER_URL) === -1) { - cta = optionalItemOrUrl; // item id url = MARKETPLACE_URL + '/items/' + optionalItemOrUrl; - } else if (optionalItemOrUrl) { - // A specific url. - match = optionalItemOrUrl.match(/\/item\/(\w+)$/); - // Don't attempt to set up wallet for a non-item url because we don't have a way to come back. - cta = (match && match[1]) || ''; } ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL); }