From c2d5b72d68a09f7071601cf0d1b4fa76ffa9485e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 8 Feb 2017 17:58:40 +0000 Subject: [PATCH] Set referrer qp in nextLink This is so that when the verification link is clicked from an email, the referrer is set on the new instance of riot when /rts/register is hit --- src/Signup.js | 4 ++++ src/SignupStages.js | 5 +++++ src/components/structures/login/Registration.js | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/Signup.js b/src/Signup.js index d3643bd749..022a93524c 100644 --- a/src/Signup.js +++ b/src/Signup.js @@ -91,6 +91,10 @@ class Register extends Signup { this.params.idSid = idSid; } + setReferrer(referrer) { + this.params.referrer = referrer; + } + setGuestAccessToken(token) { this.guestAccessToken = token; } diff --git a/src/SignupStages.js b/src/SignupStages.js index 6bdc331566..cdb9d5989b 100644 --- a/src/SignupStages.js +++ b/src/SignupStages.js @@ -136,6 +136,11 @@ class EmailIdentityStage extends Stage { "&session_id=" + encodeURIComponent(this.signupInstance.getServerData().session); + // Add the user ID of the referring user, if set + if (this.signupInstance.params.referrer) { + nextLink += "&referrer=" + encodeURIComponent(this.signupInstance.params.referrer); + } + var self = this; return this.client.requestRegisterEmailToken( this.signupInstance.email, diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index 0fc0cac527..efe7dae723 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -98,6 +98,9 @@ module.exports = React.createClass({ this.registerLogic.setRegistrationUrl(this.props.registrationUrl); this.registerLogic.setIdSid(this.props.idSid); this.registerLogic.setGuestAccessToken(this.props.guestAccessToken); + if (this.props.referrer) { + this.registerLogic.setReferrer(this.props.referrer); + } this.registerLogic.recheckState(); if (