fix: auto-publish approved blog submissions on approval
Approved user submissions now import into the blog automatically, with a backfill script for existing approvals and a WebSocket polyfill so backend Nostr relay queries work on Node 20. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,6 +40,7 @@ export default function AdminSubmissionsPage() {
|
||||
const [reviewingId, setReviewingId] = useState<string | null>(null);
|
||||
const [reviewNote, setReviewNote] = useState("");
|
||||
const [processing, setProcessing] = useState(false);
|
||||
const [success, setSuccess] = useState("");
|
||||
|
||||
const loadSubmissions = async () => {
|
||||
try {
|
||||
@@ -61,10 +62,17 @@ export default function AdminSubmissionsPage() {
|
||||
const handleReview = async (id: string, status: "APPROVED" | "REJECTED") => {
|
||||
setProcessing(true);
|
||||
setError("");
|
||||
setSuccess("");
|
||||
try {
|
||||
await api.reviewSubmission(id, { status, reviewNote: reviewNote.trim() || undefined });
|
||||
const res = await api.reviewSubmission(id, {
|
||||
status,
|
||||
reviewNote: reviewNote.trim() || undefined,
|
||||
});
|
||||
setReviewingId(null);
|
||||
setReviewNote("");
|
||||
if (status === "APPROVED" && res?.post) {
|
||||
setSuccess(`Approved and published "${res.post.title}" to the blog.`);
|
||||
}
|
||||
await loadSubmissions();
|
||||
} catch (err: any) {
|
||||
setError(err.message);
|
||||
@@ -87,6 +95,7 @@ export default function AdminSubmissionsPage() {
|
||||
</div>
|
||||
|
||||
{error && <p className="text-error text-sm">{error}</p>}
|
||||
{success && <p className="text-primary text-sm">{success}</p>}
|
||||
|
||||
<div className="flex gap-2">
|
||||
{TABS.map((tab) => (
|
||||
|
||||
Reference in New Issue
Block a user