a tool for shared writing and social publishing
0

Configure Feed

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

filter publications at origin

Jared Pereira (Mar 28, 2026, 1:48 PM -0700) d5a3c4d7 99ecb36d

+31 -15
+30 -2
actions/getIdentityData.ts
··· 4 4 import { supabaseServerClient } from "supabase/serverClient"; 5 5 import { cache } from "react"; 6 6 import { deduplicateByUri } from "src/utils/deduplicateRecords"; 7 + import { AtUri } from "@atproto/syntax"; 8 + import { TID } from "@atproto/common"; 7 9 export const getIdentityData = cache(uncachedGetIdentityData); 8 10 export async function uncachedGetIdentityData() { 9 11 let cookieStore = await cookies(); ··· 75 77 .from("publications") 76 78 .select("*") 77 79 .eq("identity_did", auth_res.data.identities.atp_did); 78 - // Deduplicate records that may exist under both pub.leaflet and site.standard namespaces 79 - const publications = deduplicateByUri(rawPublications || []); 80 + // Deduplicate records that may exist under both pub.leaflet and site.standard namespaces, 81 + // then filter to only publications created by Leaflet 82 + const publications = deduplicateByUri(rawPublications || []).filter( 83 + isLeafletPublication, 84 + ); 80 85 return { 81 86 ...auth_res.data.identities, 82 87 publications, ··· 92 97 subscription, 93 98 }; 94 99 } 100 + 101 + function isLeafletPublication(p: { uri: string; record: unknown }): boolean { 102 + try { 103 + const rkey = new AtUri(p.uri).rkey; 104 + if (!TID.is(rkey)) return false; 105 + } catch { 106 + return false; 107 + } 108 + 109 + const record = p.record as Record<string, any> | null; 110 + if (!record) return true; 111 + 112 + if (record.preferences?.greengale) return false; 113 + 114 + if ( 115 + record.theme && 116 + record.theme.$type && 117 + record.theme.$type !== "pub.leaflet.publication#theme" 118 + ) 119 + return false; 120 + 121 + return true; 122 + }
+1 -13
components/ActionBar/Publications.tsx
··· 66 66 </> 67 67 )} 68 68 69 - {identity.publications 70 - ?.filter((p) => { 71 - let record = p.record as any; 72 - if (record.preferences?.greengale) return false; 73 - if ( 74 - record.theme && 75 - record.theme.$type && 76 - record.theme.$type !== "pub.leaflet.publication#theme" 77 - ) 78 - return false; 79 - return true; 80 - }) 81 - .map((d) => { 69 + {identity.publications?.map((d) => { 82 70 return ( 83 71 <PublicationOption 84 72 {...d}