Fix user cleaning & add loading ref_link

This commit is contained in:
Reckless_Satoshi 2022-03-06 11:12:47 -08:00
parent aa89fa603e
commit 5726b82634
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 15 additions and 17 deletions

View File

@ -20,14 +20,18 @@ def users_cleansing():
# And do not have an active trade, any past contract or any reward. # And do not have an active trade, any past contract or any reward.
deleted_users = [] deleted_users = []
for user in queryset: for user in queryset:
if user.profile.pending_rewards > 0 or user.profile.earned_rewards > 0 or user.profile.claimed_rewards > 0: # Try an except, due to unknown cause for users lacking profiles.
continue try:
if not user.profile.total_contracts == 0: if user.profile.pending_rewards > 0 or user.profile.earned_rewards > 0 or user.profile.claimed_rewards > 0:
continue continue
valid, _, _ = Logics.validate_already_maker_or_taker(user) if not user.profile.total_contracts == 0:
if valid: continue
deleted_users.append(str(user)) valid, _, _ = Logics.validate_already_maker_or_taker(user)
user.delete() if valid:
deleted_users.append(str(user))
user.delete()
except:
pass
results = { results = {
"num_deleted": len(deleted_users), "num_deleted": len(deleted_users),
@ -63,13 +67,11 @@ def follow_send_payment(lnpayment):
"""Sends sats to buyer, continuous update""" """Sends sats to buyer, continuous update"""
from decouple import config from decouple import config
from base64 import b64decode
from django.utils import timezone from django.utils import timezone
from datetime import timedelta from datetime import timedelta
from api.lightning.node import LNNode, MACAROON from api.lightning.node import LNNode, MACAROON
from api.models import LNPayment, Order from api.models import LNPayment, Order
from api.logics import Logics
fee_limit_sat = int( fee_limit_sat = int(
max( max(

View File

@ -74,7 +74,7 @@ export default class BottomBar extends Component {
profileShown: false, profileShown: false,
alternative_site: 'robosats...', alternative_site: 'robosats...',
node_id: '00000000', node_id: '00000000',
referral_link: 'No referral link', referral_link: 'Loading...',
earned_rewards: 0, earned_rewards: 0,
rewardInvoice: null, rewardInvoice: null,
badInvoice: false, badInvoice: false,
@ -84,10 +84,6 @@ export default class BottomBar extends Component {
this.getInfo(); this.getInfo();
} }
handleClickSuppport = () => {
window.open("https://t.me/robosats");
};
getInfo() { getInfo() {
this.setState(null) this.setState(null)
fetch('/api/info/') fetch('/api/info/')
@ -381,7 +377,7 @@ export default class BottomBar extends Component {
</ListItemText> </ListItemText>
: :
<form style={{maxWidth: 270}}> <form style={{maxWidth: 270}}>
<Grid containter alignItems="stretch" style={{ display: "flex"}} align="center"> <Grid alignItems="stretch" style={{ display: "flex"}} align="center">
<Grid item alignItems="stretch" style={{ display: "flex" }} align="center"> <Grid item alignItems="stretch" style={{ display: "flex" }} align="center">
<TextField <TextField
error={this.state.badInvoice} error={this.state.badInvoice}

File diff suppressed because one or more lines are too long