From dd4f9d6971c3e35e1d6c46fe69180f4affeacc4b Mon Sep 17 00:00:00 2001 From: Dakota Dutko Date: Mon, 9 Sep 2024 10:49:19 -0400 Subject: [PATCH] Adds option to redistribute email for circulars (#2569) Resolves #2562. --- app/lib/kafka.server.ts | 6 ++-- ...lars.moderation.$circularId.$requestor.tsx | 18 ++++++++++-- app/routes/circulars/circulars.server.ts | 28 +++++++++++-------- .../docs.circulars.corrections/route.mdx | 4 +++ app/table-streams/circulars/index.ts | 2 +- 5 files changed, 41 insertions(+), 17 deletions(-) diff --git a/app/lib/kafka.server.ts b/app/lib/kafka.server.ts index dcaa60ba0..eb85f2fa5 100644 --- a/app/lib/kafka.server.ts +++ b/app/lib/kafka.server.ts @@ -8,10 +8,10 @@ import { Kafka } from 'gcn-kafka' import memoizee from 'memoizee' -import { domain, getEnvOrDie } from './env.server' +import { domain, getEnvOrDieInProduction } from './env.server' -const client_id = getEnvOrDie('KAFKA_CLIENT_ID') -const client_secret = getEnvOrDie('KAFKA_CLIENT_SECRET') +const client_id = getEnvOrDieInProduction('KAFKA_CLIENT_ID') ?? '' +const client_secret = getEnvOrDieInProduction('KAFKA_CLIENT_SECRET') const kafka = new Kafka({ client_id, client_secret, diff --git a/app/routes/circulars.moderation.$circularId.$requestor.tsx b/app/routes/circulars.moderation.$circularId.$requestor.tsx index 88a779f47..f5bdf846c 100644 --- a/app/routes/circulars.moderation.$circularId.$requestor.tsx +++ b/app/routes/circulars.moderation.$circularId.$requestor.tsx @@ -8,7 +8,7 @@ import type { SEOHandle } from '@nasa-gcn/remix-seo' import type { ActionFunctionArgs, LoaderFunctionArgs } from '@remix-run/node' import { Form, redirect, useLoaderData } from '@remix-run/react' -import { Button, ButtonGroup } from '@trussworks/react-uswds' +import { Button, ButtonGroup, Checkbox } from '@trussworks/react-uswds' import { diffLines, diffWords } from 'diff' import { getUser } from './_auth/user.server' @@ -41,11 +41,18 @@ export async function action({ throw new Response(null, { status: 403 }) const data = await request.formData() const intent = getFormDataString(data, 'intent') + const redistribute = getFormDataString(data, 'redistribute') === 'on' + if (!intent || !circularId || !requestor) throw new Response(null, { status: 400 }) switch (intent) { case 'approve': - await approveChangeRequest(parseFloat(circularId), requestor, user) + await approveChangeRequest( + parseFloat(circularId), + requestor, + user, + redistribute + ) break case 'reject': await deleteChangeRequest(parseFloat(circularId), requestor, user) @@ -100,6 +107,13 @@ export default function () {

Body

+