From bab6a0b84a621210ce5e0a8f2dafb069d7f51e85 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 10 Feb 2017 11:31:04 +0000 Subject: [PATCH 1/2] Persist query parameter team token across refreshes --- src/components/structures/MatrixChat.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index ab73ba366b..c3467355bd 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -191,10 +191,18 @@ module.exports = React.createClass({ MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit; } + // Persist the team token across refreshes + if (this.props.startingFragmentQueryParams.team_token) { + window.sessionStorage.setItem( + 'mx_team_token', + this.props.startingFragmentQueryParams.team_token, + ); + } + // Use the locally-stored team token first, then as a fall-back, check to see if // a referral link was used, which will contain a query parameter `team_token`. this._teamToken = window.localStorage.getItem('mx_team_token') || - this.props.startingFragmentQueryParams.team_token; + window.sessionStorage.getItem('mx_team_token'); }, componentDidMount: function() { From ec730056d85d2d1e9ec04dff4cbf705f5ffa2e5f Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 10 Feb 2017 11:39:22 +0000 Subject: [PATCH 2/2] Alter comment --- src/components/structures/MatrixChat.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index c3467355bd..8fdcf15e1b 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -191,7 +191,8 @@ module.exports = React.createClass({ MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit; } - // Persist the team token across refreshes + // Persist the team token across refreshes using sessionStorage. A new window or + // tab will not persist sessionStorage, but refreshes will. if (this.props.startingFragmentQueryParams.team_token) { window.sessionStorage.setItem( 'mx_team_token',