This commit is contained in:
Ian Philips 2022-06-28 18:51:40 -05:00
parent 359fef7ab4
commit 7c0a5f8442
4 changed files with 2 additions and 26 deletions

View File

@ -16,7 +16,7 @@ service cloud.firestore {
allow read;
allow update: if resource.data.id == request.auth.uid
&& request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle', 'followedCategories', 'referredByUserId']);
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle', 'followedCategories', 'referredByUserId', 'referredByContractId']);
}
match /{somePath=**}/portfolioHistory/{portfolioHistoryId} {

View File

@ -5,15 +5,6 @@ import { User } from 'common/user'
import { Manalink } from 'common/manalink'
import { runTxn, TxnData } from './transact'
// if the userId claiming the manalink just signed up:
// - the manalink funds come from the house
// -
// if the manalink has a refergroupid:
// - add the user to the group
// in on-create-txn detect if it was a referral bonus, create notification for both parties
// necessary for manalink: authentication from fromUser
// - sending user's funds
// - allowing new user to join closed group
export const claimManalink = functions
.runWith({ minInstances: 1 })
.https.onCall(async (slug: string, context) => {

View File

@ -78,7 +78,7 @@ export const onUpdateUser = functions.firestore
}
const txnDoc = await firestore.collection(`txns/`).doc(txn.id)
await transaction.set(txnDoc, removeUndefinedProps(txn))
await transaction.set(txnDoc, txn)
console.log('created referral with txn id:', txn.id)
transaction.update(referredByUserDoc, {
balance: referredByUser.balance + referralAmount,

View File

@ -201,21 +201,6 @@ export function listenForLogin(onUser: (user: User | null) => void) {
})
}
// create new signup banner on markets for referrees
// markets that someone signs up to bet on are referred to the market's creator
// it would be great if you could invite someone to your group/allowlist their email
// invite a user to your group with a unique link
// pass the referrer id to this function
// add the referrer id to the new user's field
// in on-update-user check if the new user had a referrer,add the new user's ide to the referrees field
// create a txn for both
// create on-create-txn that checks why it was created, create a notification for it
// manalinks no required for:
// referral from: user to site, user to another user's market, open group, implicit from market creator
// from groups or market page, get the manalink id from the url and pass it here
// then claim it upon successful signup
//
export async function firebaseLogin() {
const provider = new GoogleAuthProvider()
return signInWithPopup(auth, provider)