From 8a51c79a6e6742ae792ca58adbc323539dca6344 Mon Sep 17 00:00:00 2001 From: silverpill Date: Fri, 27 May 2022 21:20:23 +0000 Subject: [PATCH] Disable tokenization if wallet address is not exposed via API --- src/api/users.ts | 2 +- src/components/Post.vue | 2 ++ src/views/Profile.vue | 3 +-- src/views/Subscription.vue | 8 ++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/api/users.ts b/src/api/users.ts index b4a8b3d..e85cb61 100644 --- a/src/api/users.ts +++ b/src/api/users.ts @@ -42,7 +42,7 @@ export function getVerifiedEthereumAddress(profile: Profile): string | null { export interface User extends Profile { source: Source; - wallet_address: string; + wallet_address: string | null; } export interface UserCreateForm { diff --git a/src/components/Post.vue b/src/components/Post.vue index bc4709f..5d8acdf 100644 --- a/src/components/Post.vue +++ b/src/components/Post.vue @@ -463,6 +463,7 @@ export default class PostComponent extends Vue { Boolean(this.store.instance?.blockchain_contract_address) && this.post.account.id === this.store.currentUser?.id && this.post.visibility === "public" && + Boolean(this.store.currentUser?.wallet_address) && !this.isTokenized && !this.isWaitingForToken ) @@ -472,6 +473,7 @@ export default class PostComponent extends Vue { const { currentUser, instance } = this.store if ( !currentUser || + !currentUser.wallet_address || !instance || !instance.blockchain_contract_address ) { diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 16a4736..1b22aa0 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -396,8 +396,7 @@ export default class ProfileView extends Vue { // Only users with verified address can configure subscription return ( Boolean(this.store.instance?.blockchain_contract_address) && - this.profile !== null && - getVerifiedEthereumAddress(this.profile) !== null && + Boolean(this.store.currentUser?.wallet_address) && this.isCurrentUser() ) } diff --git a/src/views/Subscription.vue b/src/views/Subscription.vue index bda31f5..6ff4fb6 100644 --- a/src/views/Subscription.vue +++ b/src/views/Subscription.vue @@ -184,13 +184,17 @@ async function checkSubscription() { } function canConfigureSubscription(): boolean { - // If wallet is not connected, subscriptionConfigured is set to null - return isCurrentUser() && subscriptionConfigured === false + return ( + isCurrentUser() && + currentUser.wallet_address && + subscriptionConfigured === false + ) } async function onConfigureSubscription() { if ( !currentUser || + !currentUser.wallet_address || !isCurrentUser() || !instance || !instance.blockchain_contract_address