a tool for shared writing and social publishing
0

Configure Feed

Select the types of activity you want to include in your feed.

remove bsky_profiles writes

Jared Pereira (May 28, 2026, 5:16 PM EDT) 38846e45 8a18fb6f

+8 -114
-4
app/(app)/lish/[did]/[publication]/[rkey]/Interactions/Comments/commentAction.ts
··· 78 78 ), 79 79 ]); 80 80 81 - await supabaseServerClient.from("bsky_profiles").upsert({ 82 - did: credentialSession.did!, 83 - record: profile.value as Json, 84 - }); 85 81 let { data, error } = await supabaseServerClient 86 82 .from("comments_on_documents") 87 83 .insert({
-43
app/(app)/lish/subscribeToPublication.ts
··· 1 1 "use server"; 2 2 3 3 import { AtpBaseClient } from "lexicons/api"; 4 - import { AppBskyActorDefs, Agent as BskyAgent } from "@atproto/api"; 5 4 import { getIdentityData } from "actions/getIdentityData"; 6 5 import { restoreOAuthSession, OAuthSessionError } from "src/atproto-oauth"; 7 6 import { TID } from "@atproto/common"; ··· 10 9 import { AtUri } from "@atproto/syntax"; 11 10 import { redirect } from "next/navigation"; 12 11 import { encodeActionToSearchParam } from "app/api/oauth/[route]/afterSignInActions"; 13 - import { Json } from "supabase/database.types"; 14 - import { IdResolver } from "@atproto/identity"; 15 12 import { 16 13 Notification, 17 14 pingIdentityToUpdateNotification, ··· 20 17 21 18 let leafletFeedURI = 22 19 "at://did:plc:btxrwcaeyodrap5mnjw2fvmz/app.bsky.feed.generator/subscribedPublications"; 23 - let idResolver = new IdResolver(); 24 20 25 21 type SubscribeResult = 26 22 | { success: true; hasFeed: boolean } ··· 87 83 await pingIdentityToUpdateNotification(publicationOwner); 88 84 } 89 85 90 - let bsky = new BskyAgent(credentialSession); 91 - let [profile, resolveDid] = await Promise.all([ 92 - bsky.app.bsky.actor.profile 93 - .get({ 94 - repo: credentialSession.did!, 95 - rkey: "self", 96 - }) 97 - .catch(), 98 - idResolver.did.resolve(credentialSession.did!), 99 - ]); 100 - if (!identity.bsky_profiles && profile.value) { 101 - await supabaseServerClient.from("bsky_profiles").insert({ 102 - did: identity.atp_did, 103 - record: profile.value as Json, 104 - handle: resolveDid?.alsoKnownAs?.[0]?.slice(5), 105 - }); 106 - } 107 86 revalidatePath("/lish/[did]/[publication]", "layout"); 108 87 return { 109 88 success: true, ··· 159 138 }; 160 139 await supabaseServerClient.from("notifications").insert(notification); 161 140 await pingIdentityToUpdateNotification(publicationOwner); 162 - } 163 - 164 - let { data: existingProfile } = await supabaseServerClient 165 - .from("bsky_profiles") 166 - .select("did") 167 - .eq("did", atp_did) 168 - .maybeSingle(); 169 - if (!existingProfile) { 170 - let bsky = new BskyAgent(credentialSession); 171 - let [profile, resolveDid] = await Promise.all([ 172 - bsky.app.bsky.actor.profile 173 - .get({ repo: atp_did, rkey: "self" }) 174 - .catch(() => null), 175 - idResolver.did.resolve(atp_did).catch(() => null), 176 - ]); 177 - if (profile?.value) { 178 - await supabaseServerClient.from("bsky_profiles").insert({ 179 - did: atp_did, 180 - record: profile.value as Json, 181 - handle: resolveDid?.alsoKnownAs?.[0]?.slice(5), 182 - }); 183 - } 184 141 } 185 142 } catch (e) { 186 143 console.error(
-3
app/api/inngest/client.ts
··· 7 7 feedsIndexFollows: eventType("feeds/index-follows", { 8 8 schema: staticSchema<{ did: string }>(), 9 9 }), 10 - appviewProfileUpdate: eventType("appview/profile-update", { 11 - schema: staticSchema<{ record: any; did: string }>(), 12 - }), 13 10 appviewIndexBskyPostMention: eventType("appview/index-bsky-post-mention", { 14 11 schema: staticSchema<{ post_uri: string; document_link: string }>(), 15 12 }),
-37
app/api/inngest/functions/batched_update_profiles.ts
··· 1 - import { supabaseServerClient } from "supabase/serverClient"; 2 - import { inngest, events } from "../client"; 3 - 4 - export const batched_update_profiles = inngest.createFunction( 5 - { 6 - id: "batched_update_profiles", 7 - batchEvents: { 8 - maxSize: 100, 9 - timeout: "10s", 10 - }, 11 - triggers: [events.appviewProfileUpdate], 12 - }, 13 - async ({ events, step }) => { 14 - let existingProfiles = await supabaseServerClient 15 - .from("bsky_profiles") 16 - .select("did") 17 - .in( 18 - "did", 19 - events.map((event) => event.data.did), 20 - ); 21 - if (!existingProfiles.data) return { error: existingProfiles.error }; 22 - 23 - const profileUpdates = events.map((event) => ({ 24 - did: event.data.did, 25 - record: event.data.record, 26 - })); 27 - 28 - let { error } = await supabaseServerClient 29 - .from("bsky_profiles") 30 - .upsert(profileUpdates); 31 - return { 32 - done: true, 33 - profiles_updated: existingProfiles.data.length, 34 - error, 35 - }; 36 - }, 37 - );
-2
app/api/inngest/route.tsx
··· 2 2 import { inngest } from "app/api/inngest/client"; 3 3 import { index_post_mention } from "./functions/index_post_mention"; 4 4 import { come_online } from "./functions/come_online"; 5 - import { batched_update_profiles } from "./functions/batched_update_profiles"; 6 5 import { index_follows } from "./functions/index_follows"; 7 6 import { migrate_user_to_standard } from "./functions/migrate_user_to_standard"; 8 7 import { fix_standard_document_publications } from "./functions/fix_standard_document_publications"; ··· 21 20 functions: [ 22 21 index_post_mention, 23 22 come_online, 24 - batched_update_profiles, 25 23 index_follows, 26 24 migrate_user_to_standard, 27 25 fix_standard_document_publications,
-5
appview/index.ts
··· 104 104 105 105 async function handleEvent(evt: Event) { 106 106 if (evt.event === "identity") { 107 - if (evt.handle) 108 - await supabase 109 - .from("bsky_profiles") 110 - .update({ handle: evt.handle }) 111 - .eq("did", evt.did); 112 107 if (profileCache) { 113 108 try { 114 109 await profileCache.clearEntry(evt.did);
+7 -12
drizzle/relations.ts
··· 62 62 fields: [comments_on_documents.document], 63 63 references: [documents.uri] 64 64 }), 65 - bsky_profile: one(bsky_profiles, { 66 - fields: [comments_on_documents.profile], 67 - references: [bsky_profiles.did] 68 - }), 69 65 })); 70 66 71 67 export const documentsRelations = relations(documents, ({many}) => ({ ··· 77 73 leaflets_to_documents: many(leaflets_to_documents), 78 74 leaflets_in_publications: many(leaflets_in_publications), 79 75 publication_pages: many(publication_pages), 80 - })); 81 - 82 - export const bsky_profilesRelations = relations(bsky_profiles, ({one, many}) => ({ 83 - comments_on_documents: many(comments_on_documents), 84 - identity: one(identities, { 85 - fields: [bsky_profiles.did], 86 - references: [identities.atp_did] 87 - }), 88 76 })); 89 77 90 78 export const entitiesRelations = relations(entities, ({one, many}) => ({ ··· 130 118 }), 131 119 identity: one(identities, { 132 120 fields: [recommends_on_documents.recommender_did], 121 + references: [identities.atp_did] 122 + }), 123 + })); 124 + 125 + export const bsky_profilesRelations = relations(bsky_profiles, ({one}) => ({ 126 + identity: one(identities, { 127 + fields: [bsky_profiles.did], 133 128 references: [identities.atp_did] 134 129 }), 135 130 }));
+1 -1
drizzle/schema.ts
··· 49 49 record: jsonb("record").notNull(), 50 50 document: text("document").references(() => documents.uri, { onDelete: "cascade", onUpdate: "cascade" } ), 51 51 indexed_at: timestamp("indexed_at", { withTimezone: true, mode: 'string' }).defaultNow().notNull(), 52 - profile: text("profile").references(() => bsky_profiles.did, { onDelete: "set null", onUpdate: "cascade" } ), 52 + profile: text("profile"), 53 53 }, 54 54 (table) => { 55 55 return {
-7
supabase/database.types.ts
··· 200 200 referencedRelation: "documents" 201 201 referencedColumns: ["uri"] 202 202 }, 203 - { 204 - foreignKeyName: "comments_on_documents_profile_fkey" 205 - columns: ["profile"] 206 - isOneToOne: false 207 - referencedRelation: "bsky_profiles" 208 - referencedColumns: ["did"] 209 - }, 210 203 ] 211 204 } 212 205 custom_domain_routes: {