diff --git a/.github/workflows/import.yml b/.github/workflows/import.yml index 9adbffc..cc4020e 100644 --- a/.github/workflows/import.yml +++ b/.github/workflows/import.yml @@ -37,6 +37,11 @@ on: description: "AfterH only: current SkaDate .sql dump in the imports container (blank to skip)" type: string default: '' + dead_signups: + description: "Members who signed up on the old site but never used it (left within the hour, no messages, unverified...)" + type: choice + options: [flag, suspend, remove] + default: flag skadate_photos: description: "AfterH only: zip of SkaDate's ow_userfiles folder in the imports container (blank: no photos)" type: string @@ -63,6 +68,7 @@ jobs: LEGACY: ${{ inputs.legacy_backup }} SKADATE: ${{ inputs.skadate_dump }} SKAPHOTOS: ${{ inputs.skadate_photos }} + DEAD: ${{ inputs.dead_signups }} PREFIX: bundles/${{ inputs.site }}-${{ github.run_id }} steps: - uses: actions/checkout@v4 @@ -154,8 +160,8 @@ jobs: job="whatbox-$ENV-import" report="reports/$SITE-${{ github.run_id }}.json" case "$MODE" in - dry-run) args=(load --site "$SITE" --bundle "blob:$PREFIX" --dry-run --report-blob "$report") ;; - load) args=(load --site "$SITE" --bundle "blob:$PREFIX" --report-blob "$report") ;; + dry-run) args=(load --site "$SITE" --bundle "blob:$PREFIX" --dead-signups "$DEAD" --dry-run --report-blob "$report") ;; + load) args=(load --site "$SITE" --bundle "blob:$PREFIX" --dead-signups "$DEAD" --report-blob "$report") ;; remove) args=(remove --site "$SITE" --report-blob "$report") ;; risk-check) args=(risk-check --site "$SITE" --bundle "blob:$PREFIX" --report-blob "$report") ;; esac diff --git a/apps/api/scripts/import.ts b/apps/api/scripts/import.ts index 948d5cf..7fa22ad 100644 --- a/apps/api/scripts/import.ts +++ b/apps/api/scripts/import.ts @@ -144,6 +144,8 @@ async function argsFromBlob(): Promise { }; try { if (cmd === 'load' || cmd === 'risk-check') { + const deadSignups = (one(a, 'dead-signups', false) || 'flag') as 'flag' | 'suspend' | 'remove'; + if (!['flag', 'suspend', 'remove'].includes(deadSignups)) throw new Error('--dead-signups must be flag, suspend or remove'); const given: string[] = []; for (const b of a.bundle ?? []) { if (!b.startsWith('blob:')) { given.push(b); continue; } @@ -156,7 +158,7 @@ async function argsFromBlob(): Promise { for (const d of dirs) bundles.push(await readBundle(d)); const crypto = new SiteCrypto(keyProvider(), site.id); if (cmd === 'risk-check') await output(await riskCheckImported(bundles, { site, repo, crypto, now: new Date(), dryRun })); - else await output(await loadBundles(bundles, { site, repo, crypto, geo: new WorldGeo(), photos, now: new Date(), dryRun })); + else await output(await loadBundles(bundles, { site, repo, crypto, geo: new WorldGeo(), photos, now: new Date(), dryRun, deadSignups })); } else if (cmd === 'remove') { await output(await removeImported(repo, site, photos, dryRun)); } else { diff --git a/apps/api/src/import/bundle.ts b/apps/api/src/import/bundle.ts index 760b001..b310f5f 100644 --- a/apps/api/src/import/bundle.ts +++ b/apps/api/src/import/bundle.ts @@ -31,6 +31,8 @@ export interface SrcMember { key: string; // ":", used only to connect relations inside one run email: string; username: string; // the public name members knew them by; real names are not carried over + /** The old site made the username up (SkaDate does, e.g. "h6jm"); the member never chose it. */ + usernameGenerated?: boolean; gender: SrcGender | null; seeking: SrcGender[]; birthDate?: string; // YYYY-MM-DD @@ -41,7 +43,8 @@ export interface SrcMember { fields: Record; createdAt: string; lastActiveAt: string; - /** Things a moderator should look at, e.g. "not_approved" or "spam_suspected" on the old site. */ + /** Things a moderator should look at, e.g. "not_approved" or "spam_suspected" on the old site. + * "dead_signup": never really used the old site (left within the hour, no messages, unverified...). */ flags: string[]; photos: SrcPhoto[]; /** Countries and VPN/hosting networks the old site logged them signing in from. Derived; never the IPs. */ diff --git a/apps/api/src/import/load.ts b/apps/api/src/import/load.ts index 73991ad..67e8641 100644 --- a/apps/api/src/import/load.ts +++ b/apps/api/src/import/load.ts @@ -53,10 +53,15 @@ export function mergeMembers(bundles: Bundle[]): MergedMember[] { if (m.ageMin === undefined) { m.ageMin = src.ageMin; m.ageMax = src.ageMax; } if (!m.location.city && !m.location.lat && !m.location.postal) m.location = src.location; if (!m.about) m.about = src.about; - if (!m.username) m.username = src.username; + // A name the member chose on one site beats one the other site made up. + if (!m.username || (m.usernameGenerated && src.username && !src.usernameGenerated)) { + m.username = src.username; m.usernameGenerated = src.usernameGenerated; + } + // Someone counts as a dead signup only if they never used ANY of the old sites. + const dead = m.flags.includes('dead_signup') && src.flags.includes('dead_signup'); m.createdAt = minIso(m.createdAt, src.createdAt); m.lastActiveAt = maxIso(m.lastActiveAt, src.lastActiveAt); - m.flags = [...new Set([...m.flags, ...src.flags])]; + m.flags = [...new Set([...m.flags, ...src.flags])].filter((f) => f !== 'dead_signup' || dead); m.network = mergeNetworks(m.network, src.network); cur.photos.push(...photos); } @@ -111,6 +116,8 @@ export interface LoadDeps { photos?: PhotoStore; // without it, photos are counted but not copied now: Date; dryRun: boolean; + /** Signups that never used the old site: flag them for review (default), suspend them, or leave them out. */ + deadSignups?: 'flag' | 'suspend' | 'remove'; } export interface LoadReport { @@ -159,6 +166,20 @@ export async function loadBundles(bundles: Bundle[], d: LoadDeps): Promise(text: string) => (await db.query(text))[0] as T[]; const info: BundleInfo = { source: 'skadate', site: 'afterh', extractedAt: new Date().toISOString(), counts: {}, skipped: {} }; try { - const users = await q(`SELECT id, email, username, joinStamp, activityStamp FROM ow_base_user ORDER BY id`); + const users = await q(`SELECT id, email, username, joinStamp, activityStamp, emailVerify FROM ow_base_user ORDER BY id`); const data = new Map>(); for (const r of await q(`SELECT userId, questionName, textValue, intValue, dateValue FROM ow_base_question_data`)) { (data.get(r.userId) ?? data.set(r.userId, new Map()).get(r.userId)!).set(r.questionName, { t: r.textValue ?? '', i: Number(r.intValue ?? 0), d: r.dateValue }); @@ -58,6 +58,8 @@ export async function extractSkadate(url: string, outDir: string, opts: { photos for (const r of await q(`SELECT entityId, countryCode, lat, lng, json FROM ow_googlelocation_data WHERE entityType='user'`)) locs.set(r.entityId, r); const notApproved = new Set((await q(`SELECT userId FROM ow_base_user_disapprove`)).map((r) => r.userId)); const suspended = new Set((await q(`SELECT userId FROM ow_base_user_suspend`)).map((r) => r.userId)); + const hasAvatar = new Set((await q(`SELECT userId FROM ow_base_avatar`)).map((r) => r.userId)); + const wrote = new Set((await q(`SELECT DISTINCT senderId FROM ow_mailbox_message WHERE isSystem = 0`)).map((r) => r.senderId)); const members: SrcMember[] = []; const keep = new Set(); @@ -86,10 +88,22 @@ export async function extractSkadate(url: string, outDir: string, opts: { photos const flags: string[] = []; if (notApproved.has(u.id)) flags.push('not_approved'); if (suspended.has(u.id)) flags.push('suspended'); + // Signups that never really used the site: three or more of these signs. + const signs = [ + !Number(u.emailVerify), + Number(u.activityStamp) - Number(u.joinStamp) < 3600, + !wrote.has(u.id), + !hasAvatar.has(u.id), + notApproved.has(u.id), + d.size < 10, + ].filter(Boolean).length; + if (signs >= 3) flags.push('dead_signup'); + const username = String(u.username ?? ''); members.push({ key: 'skadate:' + u.id, email, - username: String(u.username ?? ''), + username, + usernameGenerated: looksGenerated(username), gender, seeking: skadateGenders(d.get(Q.matchSex)?.i), birthDate: birth && birth.getUTCFullYear() > 1900 ? isoDate(birth)!.slice(0, 10) : undefined, diff --git a/apps/api/test/import.test.ts b/apps/api/test/import.test.ts index a928e43..cc9f4b4 100644 --- a/apps/api/test/import.test.ts +++ b/apps/api/test/import.test.ts @@ -6,7 +6,7 @@ import { DevKeyProvider, MemorySiteRepo, SiteCrypto, seedSites } from '@whatbox/ import type { Bundle, SrcMember } from '../src/import/bundle'; import { bits, cleanText, countryCode, joinAbout, legacyAccessibility, legacyGoal, legacyHeight, legacyKids, legacyStatus, legacyStature, - seekingFor, skadateGenders, skadateGoal, skadateHeight, skadateInterests, skadateStatus, + looksGenerated, seekingFor, skadateGenders, skadateGoal, skadateHeight, skadateInterests, skadateStatus, } from '../src/import/map'; import { choosePhotos, keepFields, loadBundles, mergeMembers } from '../src/import/load'; @@ -106,3 +106,39 @@ test('loads into the named site only, and re-runs update instead of duplicating' assert.notEqual(m.emailEnc, 'a@example.com'); assert.equal((await repo.listMessagesInvolving(m.id)).length, 1); }); + +test('names SkaDate made up are not shown, and dead signups can be left out', async () => { + assert.equal(looksGenerated('h6jm'), true); + assert.equal(looksGenerated('hbkzl'), true); + assert.equal(looksGenerated('9b5kcu0s'), true); + assert.equal(looksGenerated('mike77'), false); + assert.equal(looksGenerated('sunny'), false); + assert.equal(looksGenerated('Sunny_Day'), false); + + // A real name from the older site replaces the made-up one; dead only if dead everywhere. + const merged = mergeMembers([ + bundle('skadate', [src({ key: 'skadate:3', username: 'x7kq2', usernameGenerated: true, flags: ['dead_signup'] })]), + bundle('aspnetdating', [src({ key: 'legacy:3', username: 'sunny' })]), + ]); + assert.equal(merged[0].m.username, 'sunny'); + assert.ok(!merged[0].m.flags.includes('dead_signup')); + + const site = seedSites(new Date())[0]; + const repo = new MemorySiteRepo(); + const crypto = new SiteCrypto(new DevKeyProvider('test-only'), site.id); + const geo = { countries: async () => [], postal: async () => ({ id: 'z', name: 'Denver', region: 'CO', country: 'US', lat: 39.7, lng: -105, postal: '80202' }), search: async () => [], place: async () => null, nearest: async () => null }; + const deps = { site, repo: repo as any, crypto, geo, now: new Date('2026-11-28T00:00:00Z'), dryRun: false }; + const b = bundle('skadate', [ + src({ key: 'skadate:1', username: 'h6jm', usernameGenerated: true, fields: { hsv_status: ['HSV-2'] } }), + src({ key: 'skadate:2', email: 'bot@example.com', username: 'q9zz', usernameGenerated: true, fields: { hsv_status: ['HSV-2'] }, flags: ['dead_signup'] }), + ]); + await loadBundles([b], deps); // first run keeps both (flagged) + const bot = await repo.findMemberByHash('email', await crypto.lookupHash('bot@example.com')); + assert.ok(bot); + const r = await loadBundles([b], { ...deps, deadSignups: 'remove' as const }); + assert.equal(r.members['removed (never used the old site)'], 1); + assert.equal(await repo.findMemberByHash('email', await crypto.lookupHash('bot@example.com')), null); + const real = await repo.findMemberByHash('email', await crypto.lookupHash('a@example.com')); + assert.equal(real?.displayName, ''); + assert.equal(real?.profileComplete, false); // picks a name at first sign-in +}); diff --git a/apps/member/src/app/admin/index.tsx b/apps/member/src/app/admin/index.tsx index 97e1c08..00a1e13 100644 --- a/apps/member/src/app/admin/index.tsx +++ b/apps/member/src/app/admin/index.tsx @@ -522,9 +522,9 @@ function Members({ api, siteId }: { api: AdminApi; siteId: string }) { {data.rows.map((m, idx) => ( - setOpenId(m.id)} accessibilityRole="button" accessibilityLabel={`View ${m.displayName}'s profile`}> + setOpenId(m.id)} accessibilityRole="button" accessibilityLabel={`View ${m.displayName || 'this member'}'s profile`}> - {m.displayName}{m.age ? `, ${m.age}` : ''} + {m.displayName || 'No name yet'}{m.age ? `, ${m.age}` : ''} {m.tier !== 'free' ? : null} {m.status === 'suspended' ? : null} {m.reports ? 1 ? 's' : ''}`} tone="alert" /> : null} @@ -573,7 +573,7 @@ function MemberProfilePanel({ api, siteId, memberId, onClose }: { api: AdminApi; - {p ? `${p.displayName}${p.age ? `, ${p.age}` : ''}` : 'Profile'} + {p ? `${p.displayName || 'No name yet'}${p.age ? `, ${p.age}` : ''}` : 'Profile'} diff --git a/infra/import-members.md b/infra/import-members.md index 85aab3e..bcda119 100644 --- a/infra/import-members.md +++ b/infra/import-members.md @@ -53,7 +53,7 @@ Note that the dev "Load demo data" deploy option wipes all member data on dev, i | Old site | New platform | |---|---| -| Username | Display name (real names are not carried over) | +| Username | Display name (real names are not carried over). SkaDate made up names like "h6jm" at signup; those are not shown, and the member picks a name at first sign-in (a name they chose on the older site wins) | | Email | Sign-in email (stored only as a keyed hash plus site-key encryption) | | Gender / looking for | Gender / looking for. Couples: not supported yet, left behind | | Birth date | Birth year (missing or under 18: asked at first sign-in) | @@ -70,6 +70,12 @@ Note that the dev "Load demo data" deploy option wipes all member data on dev, i | Photos approved on the old site | Approved. Unapproved or explicit ones wait in moderation (explicit ones as private, since explicit photos are off on these sites) | | Interests (winks), favourites, blocks, profile views, private photo access, mailbox messages | Likes, favorites, blocks, views, granted private access, messages | +**Dead signups** (SkaDate): accounts with three or more of: email never verified, gone within an hour of +joining, never sent a message, no photo, not approved, almost no profile answers. The workflow's +`dead_signups` input decides: `flag` (moderation item, the default), `suspend`, or `remove` (left out, +and removed if an earlier run brought them in). Someone who used either old AfterH system is never a dead signup. +AfterH was loaded with `remove` (Jeff, Nov 29). + Every member starts on the Free tier (the paywall is off at launch). Imported members with contact details in "About me", or flagged on the old site (spam suspected, not approved, suspended), get a moderation item so the site owner can look.