grain.social is a photo sharing platform built on atproto. grain.social
atproto photography appview
57
fork

Configure Feed

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

delete linked gallery items when deleting gallery

+14 -2
+14 -2
main.tsx
··· 390 390 requireAuth(ctx); 391 391 const formData = await req.formData(); 392 392 const uri = formData.get("uri") as string; 393 - await ctx.deleteRecord(uri); 393 + await deleteGallery(uri, ctx); 394 394 return ctx.redirect("/"); 395 395 }), 396 396 route( ··· 953 953 profile, 954 954 galleryPhotosMap.get(gallery.uri) ?? [], 955 955 ); 956 + } 957 + 958 + async function deleteGallery(uri: string, ctx: BffContext) { 959 + await ctx.deleteRecord(uri); 960 + const { items: galleryItems } = ctx.indexService.getRecords< 961 + WithBffMeta<GalleryItem> 962 + >("social.grain.gallery.item", { 963 + where: [{ field: "gallery", equals: uri }], 964 + }); 965 + for (const item of galleryItems) { 966 + await ctx.deleteRecord(item.uri); 967 + } 956 968 } 957 969 958 970 function getGalleryFavs(galleryUri: string, ctx: BffContext) { ··· 1813 1825 uri?: string; 1814 1826 }>) { 1815 1827 return ( 1816 - <div class="relative aspect-square dark:bg-zinc-900"> 1828 + <div class="relative aspect-square bg-zinc-200 dark:bg-zinc-900"> 1817 1829 {uri 1818 1830 ? ( 1819 1831 <button