copy changes

more copy
clean debugging... prints! lol
clean console logs
fix get users

Only get users that explicitly have been allowed or blocked
UI
UI-2
prevent getting all accounts (false, false is default)
remove client side filtering


remove prints
This commit is contained in:
Tiago Vasconcelos 2023-07-17 10:49:03 +01:00 committed by Vlad Stan
parent 07a07fc079
commit 3c45acc4d5
4 changed files with 9 additions and 7 deletions

View file

@ -391,9 +391,12 @@ async def get_accounts(
allowed=True,
blocked=False,
) -> List[NostrAccount]:
if not allowed and not blocked:
return []
rows = await db.fetchall(
"SELECT * FROM nostrrelay.accounts WHERE relay_id = ? AND allowed = ? AND blocked = ?",
"SELECT * FROM nostrrelay.accounts WHERE relay_id = ? AND allowed = ? OR blocked = ?",
(relay_id, allowed, blocked),
)
return [NostrAccount.from_row(row) for row in rows]

View file

@ -609,7 +609,6 @@
row-key="pubkey"
:columns="accountsTable.columns"
:pagination.sync="accountsTable.pagination"
:filter="accountsFilter"
>
<template v-slot:body="props">
<q-tr :props="props">

View file

@ -18,7 +18,6 @@ async function relayDetails(path) {
description: ''
}
},
accountsFilter: '',
showBlockedAccounts: true,
showAllowedAccounts: false,
accountsTable: {

View file

@ -195,6 +195,7 @@ async def api_create_or_update_account(
try:
data.pubkey = normalize_public_key(data.pubkey)
account = await get_account(data.relay_id, data.pubkey)
if not account:
account = NostrAccount(
@ -208,7 +209,7 @@ async def api_create_or_update_account(
account.blocked = data.blocked
if data.allowed is not None:
account.allowed = data.allowed
return await update_account(data.relay_id, account)
except ValueError as ex:
@ -256,8 +257,8 @@ async def api_delete_account(
@nostrrelay_ext.get("/api/v1/account")
async def api_get_accounts(
relay_id: str,
allowed=False,
blocked=True,
allowed: bool = False,
blocked: bool = True,
wallet: WalletTypeInfo = Depends(require_invoice_key),
) -> List[NostrAccount]:
try: