Retro Bulletin Board Systems on atproto. Web app and TUI. lazy mirror of alyraffauf/atbbs atbbs.xyz
forums python tui atproto bbs
3
fork

Configure Feed

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

web: drop deleted news posts

+9 -4
+8 -3
web/src/pages/BBS.tsx
··· 1 1 import { useState, type SyntheticEvent } from "react"; 2 - import { Link, useRouteLoaderData } from "react-router-dom"; 2 + import { Link, useLocation, useRouteLoaderData } from "react-router-dom"; 3 3 import { useAuth } from "../lib/auth"; 4 4 import { useBreadcrumb } from "../hooks/useBreadcrumb"; 5 5 import { createPost, uploadAttachments } from "../lib/writes"; ··· 29 29 export default function BBSPage() { 30 30 const { handle, bbs, pinRkey } = useRouteLoaderData("bbs") as BBSLoaderData; 31 31 const { user, agent } = useAuth(); 32 + // Set when arriving here via a news delete; Constellation/Slingshot may 33 + // still be returning the record, so filter it out for this one render. 34 + const justDeletedRkey = (useLocation().state as { deletedNewsRkey?: string }) 35 + ?.deletedNewsRkey; 32 36 const [newsTitle, setNewsTitle] = useState(""); 33 37 const [newsBody, setNewsBody] = useState(""); 34 38 const [newsFiles, setNewsFiles] = useState<File[]>([]); ··· 74 78 } 75 79 } 76 80 77 - // Merge pending news with loader data, deduplicating by rkey. 81 + // Merge pending news with loader data, deduplicating by rkey and dropping 82 + // anything just deleted from the News page. 78 83 const loaderTids = new Set(bbs.news.map((n) => n.rkey)); 79 84 const allNews = [ 80 85 ...pendingNews.filter((n) => !loaderTids.has(n.rkey)), 81 86 ...bbs.news, 82 - ]; 87 + ].filter((n) => n.rkey !== justDeletedRkey); 83 88 const visibleNews = showAllNews ? allNews : allNews.slice(0, 3); 84 89 85 90 return (
+1 -1
web/src/pages/News.tsx
··· 38 38 if (!confirm("Delete this news post?")) return; 39 39 await deleteRecord(agent, POST, tid); 40 40 invalidateBBSCache(); 41 - navigate(`/bbs/${handle}`); 41 + navigate(`/bbs/${handle}`, { state: { deletedNewsRkey: tid } }); 42 42 } 43 43 44 44 return (