Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit a5a43bc

Browse files
authored
Merge pull request #685 from matrix-org/luke/rts-session-team-token
Persist query parameter team token across refreshes
2 parents 8bd7d90 + ec73005 commit a5a43bc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/structures/MatrixChat.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,19 @@ module.exports = React.createClass({
191191
MatrixClientPeg.opts.initialSyncLimit = this.props.config.sync_timeline_limit;
192192
}
193193

194+
// Persist the team token across refreshes using sessionStorage. A new window or
195+
// tab will not persist sessionStorage, but refreshes will.
196+
if (this.props.startingFragmentQueryParams.team_token) {
197+
window.sessionStorage.setItem(
198+
'mx_team_token',
199+
this.props.startingFragmentQueryParams.team_token,
200+
);
201+
}
202+
194203
// Use the locally-stored team token first, then as a fall-back, check to see if
195204
// a referral link was used, which will contain a query parameter `team_token`.
196205
this._teamToken = window.localStorage.getItem('mx_team_token') ||
197-
this.props.startingFragmentQueryParams.team_token;
206+
window.sessionStorage.getItem('mx_team_token');
198207
},
199208

200209
componentDidMount: function() {

0 commit comments

Comments
 (0)