Move logs to debug status

This commit is contained in:
MartinBraquet
2025-10-09 17:59:10 +02:00
parent d7213c255c
commit a77e7b96b7
54 changed files with 129 additions and 129 deletions

View File

@@ -191,7 +191,7 @@ Object.entries(handlers).forEach(([path, handler]) => {
}
})
// console.log('COMPASS_API_KEY:', process.env.COMPASS_API_KEY)
// console.debug('COMPASS_API_KEY:', process.env.COMPASS_API_KEY)
// Internal Endpoints
app.post(pathWithPrefix("/internal/send-search-notifications"),

View File

@@ -29,7 +29,7 @@ export const createProfile: APIHandler<'create-profile'> = async (body, auth) =>
updateUser(pg, auth.uid, { avatarUrl: body.pinned_url })
}
console.log('body', body)
console.debug('body', body)
const { data, error } = await tryCatch(
insert(pg, 'profiles', { user_id: auth.uid, ...body })
@@ -46,7 +46,7 @@ export const createProfile: APIHandler<'create-profile'> = async (body, auth) =>
try {
await track(auth.uid, 'create profile', {username: user.username})
} catch (e) {
console.log('Failed to track create profile', e)
console.error('Failed to track create profile', e)
}
try {
await sendDiscordMessage(
@@ -54,7 +54,7 @@ export const createProfile: APIHandler<'create-profile'> = async (body, auth) =>
'members',
)
} catch (e) {
console.log('Failed to send discord new profile', e)
console.error('Failed to send discord new profile', e)
}
try {
const nProfiles = await pg.one<number>(
@@ -69,7 +69,7 @@ export const createProfile: APIHandler<'create-profile'> = async (body, auth) =>
n % 50 === 0
)
}
console.log(nProfiles, isMilestone(nProfiles))
console.debug(nProfiles, isMilestone(nProfiles))
if (isMilestone(nProfiles)) {
await sendDiscordMessage(
`We just reached **${nProfiles}** total profiles! 🎉`,
@@ -78,7 +78,7 @@ export const createProfile: APIHandler<'create-profile'> = async (body, auth) =>
}
} catch (e) {
console.log('Failed to send discord user milestone', e)
console.error('Failed to send discord user milestone', e)
}
}

View File

@@ -127,12 +127,12 @@ export const createUser: APIHandler<'create-user'> = async (
try {
await track(auth.uid, 'create profile', {username: user.username})
} catch (e) {
console.log('Failed to track create profile', e)
console.error('Failed to track create profile', e)
}
try {
await sendWelcomeEmail(user, privateUser)
} catch (e) {
console.log('Failed to sendWelcomeEmail', e)
console.error('Failed to sendWelcomeEmail', e)
}
}

View File

@@ -35,7 +35,7 @@ export const deleteMe: APIHandler<'me/delete'> = async (body, auth) => {
try {
const auth = admin.auth()
await auth.deleteUser(userId)
console.log(`Deleted user ${userId} from Firebase Auth and Supabase`)
console.debug(`Deleted user ${userId} from Firebase Auth and Supabase`)
} catch (e) {
console.error('Error deleting user from Firebase Auth:', e)
}

View File

@@ -39,7 +39,7 @@ export const getCompatibilityQuestions: APIHandler<
const questions = shuffle(dbQuestions)
// console.log(
// console.debug(
// 'got questions',
// questions.map((q) => q.question + ' ' + q.score)
// )

View File

@@ -29,7 +29,7 @@ export type profileQueryType = {
export const loadProfiles = async (props: profileQueryType) => {
const pg = createSupabaseDirectClient()
console.log(props)
console.debug(props)
const {
limit: limitParam,
after,
@@ -87,7 +87,7 @@ export const loadProfiles = async (props: profileQueryType) => {
const cursor = after
? profiles.findIndex((l) => l.id.toString() === after) + 1
: 0
console.log(cursor)
console.debug(cursor)
if (limitParam) return profiles.slice(cursor, cursor + limitParam)
@@ -158,7 +158,7 @@ export const loadProfiles = async (props: profileQueryType) => {
limitParam && limit(limitParam)
)
// console.log('query:', query)
// console.debug('query:', query)
return await pg.map(query, [], convertRow)
}

View File

@@ -163,7 +163,7 @@ const notifyOtherUserInChannelIfInactive = async (
// TODO: notification only for active user
const otherUser = await getUser(otherUserId.user_id)
console.log('otherUser:', otherUser)
console.debug('otherUser:', otherUser)
if (!otherUser) return
await createNewMessageNotification(creator, otherUser, channelId)
@@ -175,7 +175,7 @@ const createNewMessageNotification = async (
channelId: number
) => {
const privateUser = await getPrivateUser(toUser.id)
console.log('privateUser:', privateUser)
console.debug('privateUser:', privateUser)
if (!privateUser) return
await sendNewMessageEmail(privateUser, fromUser, toUser, channelId)
}

View File

@@ -25,7 +25,7 @@ export const sendSearchNotifications = async () => {
from('bookmarked_searches'),
)
const searches = await pg.map(search_query, [], convertSearchRow) as Row<'bookmarked_searches'>[]
console.log(`Running ${searches.length} bookmarked searches`)
console.debug(`Running ${searches.length} bookmarked searches`)
const _users = await pg.map(
renderSql(
@@ -36,7 +36,7 @@ export const sendSearchNotifications = async () => {
convertSearchRow
) as Row<'users'>[]
const users = keyBy(_users, 'id')
console.log('users', users)
console.debug('users', users)
const _privateUsers = await pg.map(
renderSql(
@@ -47,7 +47,7 @@ export const sendSearchNotifications = async () => {
convertSearchRow
) as Row<'private_users'>[]
const privateUsers = keyBy(_privateUsers, 'id')
console.log('privateUsers', privateUsers)
console.debug('privateUsers', privateUsers)
const matches: MatchesByUserType = {}
@@ -55,7 +55,7 @@ export const sendSearchNotifications = async () => {
if (typeof row.search_filters !== 'object') continue;
const props = {...row.search_filters, skipId: row.creator_id, lastModificationWithin: '24 hours'}
const profiles = await loadProfiles(props as profileQueryType)
console.log(profiles.map((item: any) => item.name))
console.debug(profiles.map((item: any) => item.name))
if (!profiles.length) continue
if (!(row.creator_id in matches)) {
if (!privateUsers[row.creator_id]) continue
@@ -74,7 +74,7 @@ export const sendSearchNotifications = async () => {
})),
})
}
console.log('matches:', JSON.stringify(matches, null, 2))
console.debug('matches:', JSON.stringify(matches, null, 2))
await notifyBookmarkedSearch(matches)
return {status: 'success'}

View File

@@ -17,7 +17,7 @@ export const sendEmail = async (
options?: CreateEmailRequestOptions
) => {
const resend = getResend()
console.log(resend, payload, options)
console.debug(resend, payload, options)
async function sendEmailThrottle(data: any, options: any) {
if (!resend) return { data: null, error: 'No Resend client' }
@@ -28,7 +28,7 @@ export const sendEmail = async (
{ replyTo: 'Compass <no-reply@compassmeet.com>', ...payload },
options
)
console.log('resend.emails.send', data, error)
console.debug('resend.emails.send', data, error)
if (error) {
log.error(
@@ -47,12 +47,12 @@ const getResend = () => {
if (resend) return resend
if (!process.env.RESEND_KEY) {
console.log('No RESEND_KEY, skipping email send')
console.debug('No RESEND_KEY, skipping email send')
return
}
const apiKey = process.env.RESEND_KEY as string
// console.log(`RESEND_KEY: ${apiKey}`)
// console.debug(`RESEND_KEY: ${apiKey}`)
resend = new Resend(apiKey)
return resend
}

View File

@@ -4,11 +4,11 @@ if (require.main === module) {
const email = process.argv[2]
if (!email) {
console.error('Please provide an email address')
console.log('Usage: ts-node send-test-email.ts your@email.com')
console.debug('Usage: ts-node send-test-email.ts your@email.com')
process.exit(1)
}
sendTestEmail(email)
.then(() => console.log('Email sent successfully!'))
.then(() => console.debug('Email sent successfully!'))
.catch((error) => console.error('Failed to send email:', error))
}

View File

@@ -36,7 +36,7 @@ runScript(async ({ pg }) => {
}
}
// console.log('updates', updates.slice(0, 10))
// console.debug('updates', updates.slice(0, 10))
// return
let count = 0

View File

@@ -24,7 +24,7 @@ runScript(async ({ pg }) => {
})
const getNodes = async (pg: SupabaseDirectClient, nodeName: string) => {
console.log(`\nSearching comments for ${nodeName}...`)
console.debug(`\nSearching comments for ${nodeName}...`)
const commentQuery = renderSql(
select('id, user_id, on_user_id, content'),
from('profile_comments'),
@@ -32,15 +32,15 @@ const getNodes = async (pg: SupabaseDirectClient, nodeName: string) => {
)
const comments = await pg.manyOrNone(commentQuery)
console.log(`Found ${comments.length} comments:`)
console.debug(`Found ${comments.length} comments:`)
comments.forEach((comment) => {
console.log('\nComment ID:', comment.id)
console.log('From user:', comment.user_id)
console.log('On user:', comment.on_user_id)
console.log('Content:', JSON.stringify(comment.content))
console.debug('\nComment ID:', comment.id)
console.debug('From user:', comment.user_id)
console.debug('On user:', comment.on_user_id)
console.debug('Content:', JSON.stringify(comment.content))
})
console.log(`\nSearching private messages for ${nodeName}...`)
console.debug(`\nSearching private messages for ${nodeName}...`)
const messageQuery = renderSql(
select('id, user_id, channel_id, content'),
from('private_user_messages'),
@@ -48,15 +48,15 @@ const getNodes = async (pg: SupabaseDirectClient, nodeName: string) => {
)
const messages = await pg.manyOrNone(messageQuery)
console.log(`Found ${messages.length} private messages:`)
console.debug(`Found ${messages.length} private messages:`)
messages.forEach((msg) => {
console.log('\nMessage ID:', msg.id)
console.log('From user:', msg.user_id)
console.log('Channel:', msg.channel_id)
console.log('Content:', JSON.stringify(msg.content))
console.debug('\nMessage ID:', msg.id)
console.debug('From user:', msg.user_id)
console.debug('Channel:', msg.channel_id)
console.debug('Content:', JSON.stringify(msg.content))
})
console.log(`\nSearching profiles for ${nodeName}...`)
console.debug(`\nSearching profiles for ${nodeName}...`)
const users = renderSql(
select('user_id, bio'),
from('profiles'),
@@ -64,9 +64,9 @@ const getNodes = async (pg: SupabaseDirectClient, nodeName: string) => {
)
const usersWithMentions = await pg.manyOrNone(users)
console.log(`Found ${usersWithMentions.length} users:`)
console.debug(`Found ${usersWithMentions.length} users:`)
usersWithMentions.forEach((user) => {
console.log('\nUser ID:', user.user_id)
console.log('Bio:', JSON.stringify(user.bio))
console.debug('\nUser ID:', user.user_id)
console.debug('Bio:', JSON.stringify(user.bio))
})
}

View File

@@ -178,7 +178,7 @@ async function getTableInfo(pg: SupabaseDirectClient, tableName: string) {
}
async function getFunctions(pg: SupabaseDirectClient) {
console.log('Getting functions')
console.debug('Getting functions')
const rows = await pg.manyOrNone<{
function_name: string
definition: string
@@ -196,7 +196,7 @@ async function getFunctions(pg: SupabaseDirectClient) {
}
async function getViews(pg: SupabaseDirectClient) {
console.log('Getting views')
console.debug('Getting views')
return pg.manyOrNone<{ view_name: string; definition: string }>(
`SELECT
table_name AS view_name,
@@ -214,7 +214,7 @@ async function generateSQLFiles(pg: SupabaseDirectClient) {
(row) => row.tablename as string
)
console.log(`Getting info for ${tables.length} tables`)
console.debug(`Getting info for ${tables.length} tables`)
const tableInfos = await Promise.all(
tables.map((table) => getTableInfo(pg, table))
)
@@ -331,7 +331,7 @@ async function generateSQLFiles(pg: SupabaseDirectClient) {
await fs.writeFile(`${outputDir}/${tableInfo.tableName}.sql`, content)
}
console.log('Writing remaining functions to functions.sql')
console.debug('Writing remaining functions to functions.sql')
let functionsContent = `-- This file is autogenerated from regen-schema.ts\n\n`
for (const func of functions) {
@@ -340,7 +340,7 @@ async function generateSQLFiles(pg: SupabaseDirectClient) {
await fs.writeFile(`${outputDir}/functions.sql`, functionsContent)
console.log('Writing views to views.sql')
console.debug('Writing views to views.sql')
let viewsContent = `-- This file is autogenerated from regen-schema.ts\n\n`
for (const view of views) {
@@ -350,7 +350,7 @@ async function generateSQLFiles(pg: SupabaseDirectClient) {
await fs.writeFile(`${outputDir}/views.sql`, viewsContent)
console.log('Prettifying SQL files...')
console.debug('Prettifying SQL files...')
execSync(
`prettier --write ${outputDir}/*.sql --ignore-path ../supabase/.gitignore`
)

View File

@@ -30,7 +30,7 @@ const removeNodesOfType = (
runScript(async ({ pg }) => {
const nodeType = 'linkPreview'
console.log('\nSearching comments for linkPreviews...')
console.debug('\nSearching comments for linkPreviews...')
const commentQuery = renderSql(
select('id, content'),
from('profile_comments'),
@@ -38,21 +38,21 @@ runScript(async ({ pg }) => {
)
const comments = await pg.manyOrNone(commentQuery)
console.log(`Found ${comments.length} comments with linkPreviews`)
console.debug(`Found ${comments.length} comments with linkPreviews`)
for (const comment of comments) {
const newContent = removeNodesOfType(comment.content, nodeType)
console.log('before', comment.content)
console.log('after', newContent)
console.debug('before', comment.content)
console.debug('after', newContent)
await pg.none('update profile_comments set content = $1 where id = $2', [
newContent,
comment.id,
])
console.log('Updated comment:', comment.id)
console.debug('Updated comment:', comment.id)
}
console.log('\nSearching private messages for linkPreviews...')
console.debug('\nSearching private messages for linkPreviews...')
const messageQuery = renderSql(
select('id, content'),
from('private_user_messages'),
@@ -60,17 +60,17 @@ runScript(async ({ pg }) => {
)
const messages = await pg.manyOrNone(messageQuery)
console.log(`Found ${messages.length} messages with linkPreviews`)
console.debug(`Found ${messages.length} messages with linkPreviews`)
for (const msg of messages) {
const newContent = removeNodesOfType(msg.content, nodeType)
console.log('before', JSON.stringify(msg.content, null, 2))
console.log('after', JSON.stringify(newContent, null, 2))
console.debug('before', JSON.stringify(msg.content, null, 2))
console.debug('after', JSON.stringify(newContent, null, 2))
await pg.none(
'update private_user_messages set content = $1 where id = $2',
[newContent, msg.id]
)
console.log('Updated message:', msg.id)
console.debug('Updated message:', msg.id)
}
})

View File

@@ -5,7 +5,7 @@ import {ENV_CONFIG, getStorageBucketId} from "common/envs/constants";
export const getServiceAccountCredentials = () => {
let keyPath = ENV_CONFIG.googleApplicationCredentials
// console.log('Using GOOGLE_APPLICATION_CREDENTIALS:', keyPath)
// console.debug('Using GOOGLE_APPLICATION_CREDENTIALS:', keyPath)
if (!keyPath) {
// throw new Error(
// `Please set the GOOGLE_APPLICATION_CREDENTIALS environment variable to contain the path to your key file.`
@@ -16,7 +16,7 @@ export const getServiceAccountCredentials = () => {
if (!keyPath.startsWith('/')) {
// Make relative paths relative to the current file
keyPath = __dirname + '/' + keyPath
// console.log(keyPath)
// console.debug(keyPath)
}
try {
@@ -41,11 +41,11 @@ export async function deleteUserFiles(username: string) {
const [files] = await bucket.getFiles({prefix: path});
if (files.length === 0) {
console.log(`No files found in bucket for user ${username}`);
console.debug(`No files found in bucket for user ${username}`);
return;
}
await Promise.all(files.map(file => file.delete()));
console.log(`Deleted ${files.length} files for user ${username}`);
console.debug(`Deleted ${files.length} files for user ${username}`);
}

View File

@@ -25,7 +25,7 @@ export const generateAvatarUrl = async (
const buffer = await res.arrayBuffer()
return await upload(userId, Buffer.from(buffer), bucket)
} catch (e) {
console.log('error generating avatar', e)
console.debug('error generating avatar', e)
return `https://${DOMAIN}/images/default-avatar.png`
}
}

View File

@@ -3,7 +3,7 @@ export const constructPrefixTsQuery = (term: string) => {
.replace(/'/g, "''")
.replace(/[!&|():*<>]/g, '')
.trim()
console.log(`Term: "${sanitized}"`)
console.debug(`Term: "${sanitized}"`)
if (sanitized === '') return ''
const tokens = sanitized.split(/\s+/)
return tokens.join(' & ') + ':*'

View File

@@ -9,12 +9,12 @@ export const initAdmin = () => {
if (IS_LOCAL) {
try {
const serviceAccount = getServiceAccountCredentials()
// console.log(serviceAccount)
// console.debug(serviceAccount)
if (!serviceAccount.project_id) {
console.log(`GOOGLE_APPLICATION_CREDENTIALS not set, skipping admin firebase init.`)
console.debug(`GOOGLE_APPLICATION_CREDENTIALS not set, skipping admin firebase init.`)
return
}
console.log(`Initializing connection to ${serviceAccount.project_id} Firebase...`)
console.debug(`Initializing connection to ${serviceAccount.project_id} Firebase...`)
return admin.initializeApp({
projectId: serviceAccount.project_id,
credential: admin.credential.cert(serviceAccount),
@@ -25,6 +25,6 @@ export const initAdmin = () => {
}
}
console.log(`Initializing connection to default Firebase...`)
console.debug(`Initializing connection to default Firebase...`)
return admin.initializeApp()
}

View File

@@ -79,7 +79,7 @@ function writeLog(
// record error properties in GCP if you just do log(err)
output['error'] = msg
}
console.log(JSON.stringify(output, replacer))
console.debug(JSON.stringify(output, replacer))
} else {
const category = Object.values(pick(data, DISPLAY_CATEGORY_KEYS)).join()
const categoryLabel = category ? dim(category) + ' ' : ''

View File

@@ -64,7 +64,7 @@ const newClient = (
...settings,
}
// console.log(config)
// console.debug(config)
return pgp(config)
}

View File

@@ -26,7 +26,7 @@ export const IS_GOOGLE_CLOUD = !!process.env.GOOGLE_CLOUD_PROJECT
export const IS_VERCEL = !!process.env.NEXT_PUBLIC_VERCEL
export const IS_LOCAL = !IS_GOOGLE_CLOUD && !IS_VERCEL
export const HOSTING_ENV = IS_GOOGLE_CLOUD ? 'Google Cloud' : IS_VERCEL ? 'Vercel' : IS_LOCAL ? 'local' : 'unknown'
console.log(`Running in ${HOSTING_ENV} (${ENV})`,);
console.debug(`Running in ${HOSTING_ENV} (${ENV})`,);
// class MissingKeyError implements Error {
// constructor(key: string) {

View File

@@ -23,10 +23,10 @@ export const geodbFetch = async (endpoint: string) => {
}
const data = await res.json()
console.log('geodbFetch', endpoint, data)
console.debug('geodbFetch', endpoint, data)
return {status: 'success', data}
} catch (error) {
console.log('geodbFetch', endpoint, error)
console.debug('geodbFetch', endpoint, error)
return {status: 'failure', data: error}
}
}

View File

@@ -5,7 +5,7 @@ const isPreferredGender = (
preferredGenders: string[] | undefined,
gender: string | undefined
) => {
// console.log('isPreferredGender', preferredGenders, gender)
// console.debug('isPreferredGender', preferredGenders, gender)
if (preferredGenders === undefined || preferredGenders.length === 0 || gender === undefined) return true
// If simple gender preference, don't include non-binary.
@@ -19,7 +19,7 @@ const isPreferredGender = (
}
export const areGenderCompatible = (profile1: ProfileRow, profile2: ProfileRow) => {
// console.log('areGenderCompatible', isPreferredGender(profile1.pref_gender, profile2.gender), isPreferredGender(profile2.pref_gender, profile1.gender))
// console.debug('areGenderCompatible', isPreferredGender(profile1.pref_gender, profile2.gender), isPreferredGender(profile2.pref_gender, profile1.gender))
return (
isPreferredGender(profile1.pref_gender, profile2.gender) &&
isPreferredGender(profile2.pref_gender, profile1.gender)

View File

@@ -4,7 +4,7 @@ import { User } from 'common/user'
export type ProfileRow = Row<'profiles'>
export type Profile = ProfileRow & { user: User }
export const getProfileRow = async (userId: string, db: SupabaseClient) => {
console.log('getProfileRow', userId)
console.debug('getProfileRow', userId)
const res = await run(db.from('profiles').select('*').eq('user_id', userId))
return res.data[0]
}

View File

@@ -32,7 +32,7 @@ type SecretId = (typeof secrets)[number]
export const getSecrets = async (credentials?: any, ...ids: SecretId[]) => {
if (!ids.length && IS_LOCAL) return {}
// console.log('Fetching secrets...')
// console.debug('Fetching secrets...')
let client: SecretManagerServiceClient
if (credentials) {
const projectId = credentials['project_id']
@@ -47,7 +47,7 @@ export const getSecrets = async (credentials?: any, ...ids: SecretId[]) => {
const secretIds = ids.length > 0 ? ids : secrets
console.log('secretIds', secretIds)
console.debug('secretIds', secretIds)
const fullSecretNames = secretIds.map(
(secret: string) =>
@@ -75,7 +75,7 @@ export const loadSecretsToEnv = async (credentials?: any) => {
for (const [key, value] of Object.entries(allSecrets)) {
if (key && value) {
process.env[key] = value
// console.log(key, value)
// console.debug(key, value)
}
}
refreshConfig()

View File

@@ -30,7 +30,7 @@ export function createClient(
opts?: SupabaseClientOptionsGeneric<'public'>
) {
const url = `https://${instanceId}.supabase.co`
// console.log('createClient', instanceId, key, opts)
// console.debug('createClient', instanceId, key, opts)
return createClientGeneric(
url,
key,

View File

@@ -67,7 +67,7 @@ export async function baseApiCall(props: {
body:
params == null || method === 'GET' ? undefined : JSON.stringify(params),
})
// console.log(req)
// console.debug(req)
return fetch(req).then(async (resp) => {
const json = (await resp.json()) as { [k: string]: any }
if (!resp.ok) {

View File

@@ -32,7 +32,7 @@ export function factorizeMatrix(
const mFeatures = fillMatrix(m, FEATURES, initCell)
const nFeatures = fillMatrix(n, FEATURES, initCell)
console.log('rows', m, 'columns', n, 'numPoints', points)
console.debug('rows', m, 'columns', n, 'numPoints', points)
const updateFeature = (a: number, b: number, error: number) =>
a + LEARNING_RATE * (2 * error * b - REGULARIZATION_RATE * a)
@@ -75,7 +75,7 @@ export function factorizeMatrix(
}
}
}
console.log(iter, 'error', totalError / points)
console.debug(iter, 'error', totalError / points)
// Complete factorization process if total error falls below a certain threshold
if (totalError / points < THRESHOLD) break

View File

@@ -44,7 +44,7 @@ export function wantsKidsToHasKidsFilter(wantsKidsStrength: wantsKidsDatabase) {
export function wantsKidsDatabaseToWantsKidsFilter(
wantsKidsStrength: wantsKidsDatabase
) {
// console.log(wantsKidsStrength)
// console.debug(wantsKidsStrength)
if (wantsKidsStrength == wantsKidsLabels.no_preference.strength) {
return wantsKidsLabels.no_preference.strength
}

View File

@@ -58,7 +58,7 @@ function AddCompatibilityQuestionModal(props: {
)
const afterAddQuestion = (newQuestion: rowFor<'love_questions'>) => {
setDbQuestion(newQuestion)
console.log('setDbQuestion', newQuestion)
console.debug('setDbQuestion', newQuestion)
}
return (
@@ -137,7 +137,7 @@ function CreateCompatibilityModalContent(props: {
options: generateJson(),
};
const newQuestion = await api('create-compatibility-question', data)
console.log('create-compatibility-question', newQuestion, data)
console.debug('create-compatibility-question', newQuestion, data)
const q = newQuestion?.question
if (q) {
afterAddQuestion(q as rowFor<'love_questions'>)

View File

@@ -130,18 +130,18 @@ export function SignupBio(props: {
<TextEditor
editor={editor}
onBlur={() => {
// console.log('onchange', editor?.getText())
// console.debug('onchange', editor?.getText())
if (!editor) return
const e = editor.getJSON()
// console.log(e)
// console.debug(e)
// const text = e.content.map((block: any) => block.content?.map((c: any) => c.text).join('') ?? '').join('');
// setCharLength(text.length)
// console.log(text, text.length)
// console.debug(text, text.length)
// if (text.length < 250) {
// return; // do not save
// }
// console.log('bio changed', e, profile.bio);
// console.debug('bio changed', e, profile.bio);
onChange(e)
}}
/>

View File

@@ -55,7 +55,7 @@
// // })
// setDialogOpen(false)
//
// // console.log('result', result)
// // console.debug('result', result)
//
// // if (result.success) {
// // window.location.reload()

View File

@@ -80,7 +80,7 @@ export const useFilters = (you: Profile | undefined) => {
(you?.wants_kids_strength ?? 2) as wantsKidsDatabase
),
}
console.log(you, yourFilters)
console.debug(you, yourFilters)
const isYourFilters =
!!you &&

View File

@@ -65,7 +65,7 @@ export const OptionalLoveUserForm = (props: {
const handleSubmit = async () => {
setIsSubmitting(true)
const {bio: _, ...otherProfileProps} = profile
console.log('otherProfileProps', removeNullOrUndefinedProps(otherProfileProps))
console.debug('otherProfileProps', removeNullOrUndefinedProps(otherProfileProps))
const {error} = await tryCatch(
updateProfile(removeNullOrUndefinedProps(otherProfileProps) as any)
)

View File

@@ -46,7 +46,7 @@ export default function ProfileHeader(props: {
const isCurrentUser = currentUser?.id === user.id
const [showVisibilityModal, setShowVisibilityModal] = useState(false)
console.log('ProfileProfileHeader', {user, profile, currentUser})
console.debug('ProfileProfileHeader', {user, profile, currentUser})
return (
<Col className="w-full">

View File

@@ -24,7 +24,7 @@ export function ProfileInfo(props: {
fromSignup?: boolean
}) {
const {profile, user, refreshProfile, fromProfilePage, fromSignup} = props
console.log('Rendering Profile for', user.username, user.name, props)
console.debug('Rendering Profile for', user.username, user.name, props)
const currentUser = useUser()
// const currentProfile = useProfile()

View File

@@ -141,7 +141,7 @@ const QuestionRow = (props: { row: rowFor<'love_questions'>; user: User }) => {
className={'w-44'}
choicesMap={options}
setChoice={(choice) => {
// console.log(choice)
// console.debug(choice)
const updatedForm = { ...form, multiple_choice: choice }
setForm(updatedForm)
submitAnswer(updatedForm)

View File

@@ -128,7 +128,7 @@ export const RequiredLoveUserForm = (props: {
<label className={clsx(labelClassName)}>Bio</label>
<SignupBio
onChange={(e: JSONContent) => {
console.log('bio changed', e, profile.bio)
console.debug('bio changed', e, profile.bio)
setProfile('bio', e)
}}
/>

View File

@@ -50,7 +50,7 @@ export const Avatar = memo(
: `https://ui-avatars.com/api/?name=${encodeURIComponent(fallbackInitial)}`;
// console.log(url)
// console.debug(url)
// there can be no avatar URL or username in the feed, we show a "submit comment"
// item with a fake grey user circle guy even if you aren't signed in

View File

@@ -125,7 +125,7 @@ const UserAvatar = (props: { userId: string; className?: string }) => {
const profile = useProfileByUserId(userId)
const user = useUserById(userId)
// console.log('UserAvatar', user?.username, profile?.pinned_url)
// console.debug('UserAvatar', user?.username, profile?.pinned_url)
if (!profile)
return <EmptyAvatar className={className} size={10} />

View File

@@ -19,12 +19,12 @@ export function useNearbyCities(
cityId: referenceCityId,
radius,
}).then((result) => {
console.log('search-near-city', result)
console.debug('search-near-city', result)
if (thisSearchCount == searchCount.current) {
if (result.status === 'failure') {
setNearbyCities(null)
lastKnownCities.current = null
console.log('ERROR:', result.data)
console.error(result.data)
} else {
const cities = (result.data.data as any[]).map((city) =>
city.id.toString()

View File

@@ -22,7 +22,7 @@ export function usePrivateMessages(
limit: number,
userId: string
) {
console.log('getWebsocketUrl', getWebsocketUrl())
// console.debug('getWebsocketUrl', getWebsocketUrl())
const [messages, setMessages] = usePersistentLocalState<
PrivateChatMessage[] | undefined
>(undefined, `private-messages-${channelId}-${limit}-v1`)

View File

@@ -15,7 +15,7 @@ export const useProfile = () => {
const refreshProfile = () => {
if (user) {
console.log('Refreshing profile in useProfile for', user?.username, profile);
console.debug('Refreshing profile in useProfile for', user?.username, profile);
getProfileRow(user.id, db).then((profile) => {
if (!profile) setProfile(null)
else setProfile(profile)
@@ -38,18 +38,18 @@ export const useProfileByUser = (user: User | undefined) => {
function refreshProfile() {
if (userId) {
console.log('Refreshing profile in useProfileByUser for', user?.username, profile);
console.debug('Refreshing profile in useProfileByUser for', user?.username, profile);
getProfileRow(userId, db)
.then((profile) => {
if (!profile) setProfile(null)
else setProfile({...profile, user})
})
.catch(error => {
console.log('Warning: profile not found', user?.username, error);
console.debug('Warning: profile not found', user?.username, error);
setProfile(null)
return
});
console.log('End Refreshing profile for', user?.username, profile);
console.debug('End Refreshing profile for', user?.username, profile);
}
}
@@ -66,7 +66,7 @@ export const useProfileByUserId = (userId: string | undefined) => {
>(undefined, `profile-${userId}`)
useEffect(() => {
console.log('Refreshing profile in useProfileByUserId for', userId, profile);
console.debug('Refreshing profile in useProfileByUserId for', userId, profile);
if (userId)
getProfileRow(userId, db).then((profile) => {
if (!profile) setProfile(null)

View File

@@ -29,7 +29,7 @@ export const useWebsocketUser = (userId: string | undefined) => {
useApiSubscription({
topics: [`user/${userId ?? '_'}`],
onBroadcast: ({ data }) => {
console.log(data)
console.debug(data)
setUser((user) => {
if (!user || !data.user) {
return user

View File

@@ -10,7 +10,7 @@ async function handleResponse(response: any) {
const credential = GoogleAuthProvider.credential(idToken)
try {
const result = await signInWithCredential(auth, credential)
console.log(result.user)
console.debug(result.user)
} catch (error) {
console.error('could not log in via onetap', error)
}

View File

@@ -4,7 +4,7 @@ import { ENV_CONFIG } from 'common/envs/constants'
let currentToken: string | undefined
export function initSupabaseClient() {
// console.log('Initializing supabase client', ENV_CONFIG.supabaseInstanceId, ENV_CONFIG.supabaseAnonKey)
// console.debug('Initializing supabase client', ENV_CONFIG.supabaseInstanceId, ENV_CONFIG.supabaseAnonKey)
return createClient(ENV_CONFIG.supabaseInstanceId, ENV_CONFIG.supabaseAnonKey)
}

View File

@@ -14,14 +14,14 @@ export function copyToClipboard(text: string) {
(window as any).clipboardData &&
(window as any).clipboardData.setData
) {
console.log('copy 2')
console.debug('copy 2')
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
return (window as any).clipboardData.setData('Text', text)
} else if (
document.queryCommandSupported &&
document.queryCommandSupported('copy')
) {
console.log('copy 3')
console.debug('copy 3')
const textarea = document.createElement('textarea')
textarea.textContent = text
textarea.style.position = 'fixed' // Prevent scrolling to bottom of page in Microsoft Edge.

View File

@@ -24,7 +24,7 @@ export const getStaticProps: GetStaticProps<
UserPageProps,
{ username: string }
> = async (props) => {
// console.log('Starting getStaticProps in /[username]')
// console.debug('Starting getStaticProps in /[username]')
const {username} = props.params!
const user = await getUserForStaticProps(db, username)
@@ -86,7 +86,7 @@ type ActiveUserPageProps = {
}
export default function UserPage(props: UserPageProps) {
// console.log('Starting UserPage in /[username]')
// console.debug('Starting UserPage in /[username]')
if (!props.user) {
return <div>This account has been deleted</div>
}
@@ -99,7 +99,7 @@ export default function UserPage(props: UserPageProps) {
}
function UserPageInner(props: ActiveUserPageProps) {
// console.log('Starting UserPageInner in /[username]')
// console.debug('Starting UserPageInner in /[username]')
const {user, username} = props
const router = useRouter()
const {query} = router
@@ -117,7 +117,7 @@ function UserPageInner(props: ActiveUserPageProps) {
const {profile: clientProfile, refreshProfile} = useProfileByUser(user)
// Show previous profile while loading another one
const profile = clientProfile ?? staticProfile
// console.log('profile:', user?.username, profile, clientProfile, staticProfile)
// console.debug('profile:', user?.username, profile, clientProfile, staticProfile)
return (
<LovePage

View File

@@ -42,13 +42,13 @@ export default function TestUser() {
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
setSubmitting(false)
console.log('SUCCESS creating firebase user', userCredential)
console.debug('SUCCESS creating firebase user', userCredential)
})
.catch((error) => {
setSubmitting(false)
const errorCode = error.code
const errorMessage = error.message
console.log('ERROR creating firebase user', errorCode, errorMessage)
console.error('ERROR creating firebase user', errorCode, errorMessage)
})
}
const login = () => {
@@ -57,13 +57,13 @@ export default function TestUser() {
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
setSubmitting(false)
console.log('SUCCESS logging in firebase user', userCredential)
console.debug('SUCCESS logging in firebase user', userCredential)
})
.catch((error) => {
setSigningIn(false)
const errorCode = error.code
const errorMessage = error.message
console.log('ERROR logging in firebase user', errorCode, errorMessage)
console.error('ERROR logging in firebase user', errorCode, errorMessage)
})
}

View File

@@ -115,7 +115,7 @@ export default async function handler(req: NextRequest) {
return new ImageResponse(classToTw(image), options as ImageResponseOptions)
} catch (e: any) {
console.log(`${e.message}`)
console.error(`${e.message}`)
return new Response(`Failed to generate the image`, {
status: 500,
})

View File

@@ -7,7 +7,7 @@ import {ProfilesHome} from "web/components/profiles/profiles-home";
export default function ProfilesPage() {
const user = useUser();
console.log('user:', user)
console.debug('user:', user)
return (
<LovePage trackPageView={'user profiles'}>

View File

@@ -57,7 +57,7 @@ function RegisterComponent() {
const handleEmailPasswordSignUp = async (email: string, password: string) => {
try {
const creds = await createUserWithEmailAndPassword(auth, email, password);
console.log("User signed up:", creds.user);
console.debug("User signed up:", creds.user);
} catch (error) {
console.error("Error signing up:", error);
if (error instanceof Error && error.message.includes("email-already-in-use")) {

View File

@@ -41,7 +41,7 @@ function RegisterComponent() {
useEffect(() => {
const checkAndRedirect = async () => {
if (user) {
console.log("User signed in:", user);
console.debug("User signed in:", user);
try {
const profile = await getProfileRow(user.id, db)
if (profile) {
@@ -80,7 +80,7 @@ function RegisterComponent() {
const handleEmailPasswordSignIn = async (email: string, password: string) => {
try {
const creds = await signInWithEmailAndPassword(auth, email, password);
console.log(creds)
console.debug(creds)
} catch (error) {
console.error("Error signing in:", error);
const message = 'Failed to sign in with your email and password';
@@ -115,7 +115,7 @@ function RegisterComponent() {
}
}
console.log('Form rendering');
console.debug('Form rendering');
return (
<LovePage trackPageView={'signin'}>
<div className="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">

View File

@@ -20,7 +20,7 @@ import {Button} from "web/components/buttons/button";
export default function SignupPage() {
const [step, setStep] = useState(0)
const user = useUser()
console.log('user:', user)
console.debug('user:', user)
const router = useRouter()
useTracking('view love signup page')
@@ -91,7 +91,7 @@ export default function SignupPage() {
: undefined
setIsSubmitting(true)
console.log('profileForm', profileForm)
console.debug('profileForm', profileForm)
const profile = await api(
'create-profile',
removeNullOrUndefinedProps({