From 830739c901aa2623ee4aa0831cebc9443673b4ac Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 5 Nov 2020 11:28:20 +0100 Subject: [PATCH] Fix teams APP issue after login redirect --- www/common/sframe-common-outer.js | 3 ++- www/teams/main.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index f6f24c5bf..ad128db33 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -121,6 +121,7 @@ define([ Utils.Feedback = _Feedback; Utils.LocalStore = _LocalStore; Utils.UserObject = _UserObject; + Utils.currentPad = currentPad; AppConfig = _AppConfig; Test = _Test; @@ -604,7 +605,7 @@ define([ for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; } if (cfg.addData) { - cfg.addData(metaObj.priv, Cryptpad, metaObj.user); + cfg.addData(metaObj.priv, Cryptpad, metaObj.user, Utils); } sframeChan.event('EV_METADATA_UPDATE', metaObj); diff --git a/www/teams/main.js b/www/teams/main.js index 722cd7c1b..044419dfc 100644 --- a/www/teams/main.js +++ b/www/teams/main.js @@ -97,9 +97,12 @@ define([ var secret = Hash.getSecrets('team', hash); cb(null, secret); }; - var addData = function (meta) { - if (!hash) { return; } - meta.teamInviteHash = hash.slice(1); + var addData = function (meta, Cryptpad, user, Utils) { + if (!Utils.currentPad.hash) { return; } + var _hash = Utils.currentPad.hash.replace(/^#/, ''); + var parsed = Utils.Hash.parseTypeHash('invite', _hash); + if (parsed.app !== 'invite') { return; } + meta.teamInviteHash = _hash; }; SFCommonO.start({ getSecrets: getSecrets,