From f2cd20c8f037442f1b2893cb0e5ea5cc141ecc2c Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Fri, 16 Sep 2022 09:45:09 -0700 Subject: [PATCH] Add Telegram context on UserGen response --- api/views.py | 4 +++- frontend/src/components/HomePage.js | 3 --- frontend/src/components/UserGenPage.js | 3 +++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/views.py b/api/views.py index 8a698645..5876101d 100644 --- a/api/views.py +++ b/api/views.py @@ -736,7 +736,6 @@ class UserView(APIView): user.profile.referred_by = queryset[0] user.profile.wants_stealth = False - user.profile.save() context["public_key"] = user.profile.public_key @@ -755,6 +754,9 @@ class UserView(APIView): context["referral_code"] = str(user.profile.referral_code) context["wants_stealth"] = user.profile.wants_stealth + # Adds/generate telegram token and whether it is enabled + context = {**context,**Telegram.get_context(user)} + # return active order or last made order if any has_no_active_order, _, order = Logics.validate_already_maker_or_taker(request.user) if not has_no_active_order: diff --git a/frontend/src/components/HomePage.js b/frontend/src/components/HomePage.js index 7f11d72c..950d2246 100644 --- a/frontend/src/components/HomePage.js +++ b/frontend/src/components/HomePage.js @@ -3,9 +3,6 @@ import { BrowserRouter as Router, Switch, Route, - Link, - Redirect, - useHistory, } from 'react-router-dom'; import UserGenPage from './UserGenPage'; diff --git a/frontend/src/components/UserGenPage.js b/frontend/src/components/UserGenPage.js index 3ac5626a..8c5a76c2 100644 --- a/frontend/src/components/UserGenPage.js +++ b/frontend/src/components/UserGenPage.js @@ -98,6 +98,9 @@ class UserGenPage extends Component { earnedRewards: data.earned_rewards, lastOrderId: data.last_order_id ? data.last_order_id : null, stealthInvoices: data.wants_stealth, + tgEnabled: data.tg_enabled, + tgBotName: data.tg_bot_name, + tgToken: data.tg_token, }) : this.props.setAppState({ nickname: data.nickname,