Filter for ian's deleted users

This commit is contained in:
Ian Philips 2022-07-01 08:29:12 -06:00
parent 3165e42119
commit 5034a43c3c
2 changed files with 15 additions and 9 deletions

View File

@ -55,15 +55,19 @@ async function handleUserUpdatedReferral(user: User, eventId: string) {
.where('category', '==', 'REFERRAL')
.get()
).docs.map((txn) => txn.ref)
if (txns.length > 0) {
const referralTxns = await transaction.getAll(...txns).catch((err) => {
console.error('error getting txns:', err)
throw err
})
// If the referring user already has a referral txn due to referring this user, halt
if (referralTxns.map((txn) => txn.data()?.description).includes(user.id)) {
if (
referralTxns.map((txn) => txn.data()?.description).includes(user.id)
) {
console.log('found referral txn with the same details, aborting')
return
}
}
console.log('creating referral txns')
const fromId = HOUSE_LIQUIDITY_PROVIDER_ID

View File

@ -74,7 +74,9 @@ export function useMembers(group: Group) {
}
export async function listMembers(group: Group) {
return await Promise.all(group.memberIds.map(getUser))
return (await Promise.all(group.memberIds.map(getUser))).filter(
(user) => user
)
}
export const useGroupsWithContract = (contractId: string | undefined) => {