From 8abbb483fc050835da931d7e06e957dfb19d2c00 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Fri, 24 Nov 2023 13:03:45 -0700 Subject: [PATCH 01/29] don't use data cache for retrieving R&R, QA, archived action presence we don't prime the cache when we have stories in these states, so we can't rely on the cache for this data. Instead, rely on mongo for these isolated incidents and the action presence will be correct. --- server/src/core/server/graph/loaders/Comments.ts | 8 ++++++-- server/src/core/server/graph/resolvers/Comment.ts | 3 +++ server/src/core/server/models/action/comment.ts | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/src/core/server/graph/loaders/Comments.ts b/server/src/core/server/graph/loaders/Comments.ts index 66e743aba8..003471e8b5 100644 --- a/server/src/core/server/graph/loaders/Comments.ts +++ b/server/src/core/server/graph/loaders/Comments.ts @@ -58,7 +58,7 @@ const tagFilter = (tag?: GQLTAG): CommentConnectionInput["filter"] => { return {}; }; -const isRatingsAndReviews = ( +export const isRatingsAndReviews = ( tenant: Pick, story: Story ) => { @@ -68,7 +68,7 @@ const isRatingsAndReviews = ( ); }; -const isQA = (tenant: Pick, story: Story) => { +export const isQA = (tenant: Pick, story: Story) => { return ( hasFeatureFlag(tenant, GQLFEATURE_FLAG.ENABLE_QA) && story.settings.mode === GQLSTORY_MODE.QA @@ -173,6 +173,8 @@ const mapVisibleComment = (user?: Pick) => { interface ActionPresenceArgs { commentID: string; isArchived: boolean; + isQA: boolean; + isRR: boolean; } /** @@ -268,6 +270,7 @@ export default (ctx: GraphContext) => ({ const commentIDs = args.map((rd) => rd.commentID); const hasArchivedData = args.some((rd) => rd.isArchived); + const hasRROrQA = args.some((rd) => rd.isQA || rd.isRR); const result = await retrieveManyUserActionPresence( ctx.mongo, @@ -275,6 +278,7 @@ export default (ctx: GraphContext) => ({ ctx.tenant.id, ctx.user.id, commentIDs, + !(hasRROrQA || hasArchivedData), hasArchivedData ); diff --git a/server/src/core/server/graph/resolvers/Comment.ts b/server/src/core/server/graph/resolvers/Comment.ts index 8abf05999c..1f0143c6fc 100644 --- a/server/src/core/server/graph/resolvers/Comment.ts +++ b/server/src/core/server/graph/resolvers/Comment.ts @@ -32,6 +32,7 @@ import { } from "coral-server/graph/schema/__generated__/types"; import GraphContext from "../context"; +import { isQA, isRatingsAndReviews } from "../loaders/Comments"; import { setCacheHint } from "../setCacheHint"; export const maybeLoadOnlyID = async ( @@ -213,6 +214,8 @@ export const Comment: GQLCommentTypeResolver = { return ctx.loaders.Comments.retrieveMyActionPresence.load({ commentID: c.id, isArchived: !!story.isArchived, + isRR: isRatingsAndReviews(ctx.tenant, story), + isQA: isQA(ctx.tenant, story), }); }, diff --git a/server/src/core/server/models/action/comment.ts b/server/src/core/server/models/action/comment.ts index df520c2693..af2380b711 100644 --- a/server/src/core/server/models/action/comment.ts +++ b/server/src/core/server/models/action/comment.ts @@ -377,11 +377,13 @@ export async function retrieveManyUserActionPresence( tenantID: string, userID: string | null, commentIDs: string[], + useCache = true, isArchived = false ): Promise { let actions: Readonly[] = []; - const cacheAvailable = await commentActionsCache.available(tenantID); + const cacheAvailable = + useCache && (await commentActionsCache.available(tenantID)); if (cacheAvailable) { const actionsFromCache = await commentActionsCache.findMany( tenantID, From cfaa294dee3b103b5ff2b6d68f6263a946ff72bf Mon Sep 17 00:00:00 2001 From: nick-funk Date: Fri, 24 Nov 2023 13:04:34 -0700 Subject: [PATCH 02/29] allow admins to archive/unarchive stories --- client/src/core/client/admin/permissions/story.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/core/client/admin/permissions/story.ts b/client/src/core/client/admin/permissions/story.ts index 49e0273588..973492a6e7 100644 --- a/client/src/core/client/admin/permissions/story.ts +++ b/client/src/core/client/admin/permissions/story.ts @@ -17,7 +17,7 @@ const permissionMap: PermissionMap = { [GQLUSER_ROLE.MODERATOR]: () => true, }, ARCHIVE_STORY: { - [GQLUSER_ROLE.ADMIN]: () => false, + [GQLUSER_ROLE.ADMIN]: () => true, }, }; From cb5875c993847ea5f8094e54ef5d8e659d9d8688 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Fri, 24 Nov 2023 16:37:32 -0700 Subject: [PATCH 03/29] move accountDeleted translation to server side `common.ftl` --- locales/en-US/common.ftl | 2 -- server/src/core/server/locales/en-US/common.ftl | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/locales/en-US/common.ftl b/locales/en-US/common.ftl index 27ef2acfca..e295b15b03 100644 --- a/locales/en-US/common.ftl +++ b/locales/en-US/common.ftl @@ -62,5 +62,3 @@ common-moderationReason-detailedExplanation-placeholder = common-userBanned = User was banned. -common-accountDeleted = - User account was deleted. diff --git a/server/src/core/server/locales/en-US/common.ftl b/server/src/core/server/locales/en-US/common.ftl index fb925bf81f..1fd09047df 100644 --- a/server/src/core/server/locales/en-US/common.ftl +++ b/server/src/core/server/locales/en-US/common.ftl @@ -149,3 +149,6 @@ notifications-dsaReportDecisionMade-body-withInfo = { $decision }
{ $information } + +common-accountDeleted = + User account was deleted. From 50a206891452692acfec12ca2396bb2248a62e08 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Mon, 27 Nov 2023 09:27:02 -0700 Subject: [PATCH 04/29] show rejected "unavailabe in stream" on DSA reports when a comment is rejected and unavailable stream side, indicate this to the moderators so they don't waste time trying to click on the stream link. --- .../admin/routes/Reports/ReportedComment.css | 31 +++++++++++ .../admin/routes/Reports/ReportedComment.tsx | 51 +++++++++++++------ locales/en-US/admin.ftl | 2 + 3 files changed, 68 insertions(+), 16 deletions(-) diff --git a/client/src/core/client/admin/routes/Reports/ReportedComment.css b/client/src/core/client/admin/routes/Reports/ReportedComment.css index f15a0a420b..905e4c9edf 100644 --- a/client/src/core/client/admin/routes/Reports/ReportedComment.css +++ b/client/src/core/client/admin/routes/Reports/ReportedComment.css @@ -47,3 +47,34 @@ font-weight: var(--font-weight-primary-regular); white-space: pre-wrap; } + +.commentReported { + padding-top: calc(var(--spacing-1) / 2); + padding-bottom: calc(var(--spacing-1) / 2); + padding-right: calc(var(--spacing-1)); + padding-left: calc(var(--spacing-1)); + + background-color: var(--palette-error-500); + + border-color: var(--palette-error-500); + border-style: solid; + border-radius: 3px; + + color: var(--palette-text-000); + + text-transform: uppercase; + + font-size: var(--font-size-1); + font-weight: var(--font-weight-primary-regular); + font-family: var(--font-family-primary); + + margin-right: var(--spacing-1); +} + +.commentNotAvailableInStream { + font-size: var(--font-size-1); + font-weight: var(--font-weight-primary-regular); + font-family: var(--font-family-primary); + + color: var(--palette-grey-400); +} diff --git a/client/src/core/client/admin/routes/Reports/ReportedComment.tsx b/client/src/core/client/admin/routes/Reports/ReportedComment.tsx index 921e67aec8..9d6b01ceee 100644 --- a/client/src/core/client/admin/routes/Reports/ReportedComment.tsx +++ b/client/src/core/client/admin/routes/Reports/ReportedComment.tsx @@ -15,6 +15,7 @@ import { getURLWithCommentID, } from "coral-framework/helpers"; import { withFragmentContainer } from "coral-framework/lib/relay"; +import { GQLCOMMENT_STATUS } from "coral-framework/schema"; import { Button, Flex, @@ -130,22 +131,39 @@ const ReportedComment: FunctionComponent = ({ - - - - - + {comment.status === GQLCOMMENT_STATUS.REJECTED ? ( + + + +
+ Rejected +
+
+ +
+ Unavailable in stream +
+
+
+
+ ) : ( + + + + + + )} + + ); + })} +
+ ); +}; + +const enhanced = withFragmentContainer({ + dsaReport: graphql` + fragment RelatedReports_dsaReport on DSAReport + @argumentDefinitions( + count: { type: "Int", defaultValue: 20 } + cursor: { type: "Cursor" } + orderBy: { type: "REPORT_SORT", defaultValue: CREATED_AT_DESC } + ) { + id + relatedReports(first: $count, after: $cursor, orderBy: $orderBy) + @connection(key: "RelatedReports_relatedReports") { + edges { + node { + id + referenceID + } + } + } + } + `, +})(RelatedReports); + +export default enhanced; diff --git a/client/src/core/client/admin/routes/Reports/SingleReportRoute.tsx b/client/src/core/client/admin/routes/Reports/SingleReportRoute.tsx index 605e71b167..78914c36ae 100644 --- a/client/src/core/client/admin/routes/Reports/SingleReportRoute.tsx +++ b/client/src/core/client/admin/routes/Reports/SingleReportRoute.tsx @@ -36,6 +36,7 @@ import styles from "./SingleReportRoute.css"; import NotFound from "../NotFound"; import ChangeStatusModal from "./ChangeStatusModal"; +import RelatedReports from "./RelatedReports"; import ReportedComment from "./ReportedComment"; import ReportHistory from "./ReportHistory"; import ReportMakeDecisionModal from "./ReportMakeDecisionModal"; @@ -235,6 +236,7 @@ const SingleReportRoute: FunctionComponent & { dsaReport={dsaReport} onShowUserDrawer={onShowUserDrawer} /> + {dsaReport.decision && ( <> @@ -381,6 +383,7 @@ SingleReportRoute.routeConfig = createRouteConfig< ...ReportShareButton_dsaReport ...ReportMakeDecisionModal_dsaReport ...ReportedComment_dsaReport + ...RelatedReports_dsaReport } } `, diff --git a/locales/en-US/admin.ftl b/locales/en-US/admin.ftl index d30171666f..c5fe98cc65 100644 --- a/locales/en-US/admin.ftl +++ b/locales/en-US/admin.ftl @@ -1909,6 +1909,9 @@ reports-decisionModal-detailedExplanationLabel = Detailed explanation reports-decisionModal-detailedExplanationTextarea = .placeholder = Add explanation... +reports-relatedReports-label = Related reports +reports-relatedReports-reportIDLabel = Report ID + # Control panel controlPanel-redis-redis = Redis diff --git a/server/src/core/server/graph/loaders/DSAReports.ts b/server/src/core/server/graph/loaders/DSAReports.ts index b84b932206..e21a65827d 100644 --- a/server/src/core/server/graph/loaders/DSAReports.ts +++ b/server/src/core/server/graph/loaders/DSAReports.ts @@ -5,12 +5,14 @@ import { DSAReportConnectionInput, find, retrieveDSAReportConnection, + retrieveDSAReportRelatedReportsConnection, } from "coral-server/models/dsaReport"; import GraphContext from "../context"; import { createManyBatchLoadFn } from "./util"; import { + DSAReportToRelatedReportsArgs, GQLDSAREPORT_STATUS_FILTER, GQLREPORT_SORT, QueryToDsaReportsArgs, @@ -53,4 +55,19 @@ export default (ctx: GraphContext) => ({ cache: !ctx.disableCaching, } ), + relatedReports: ( + submissionID: string, + id: string, + { first, orderBy }: DSAReportToRelatedReportsArgs + ) => + retrieveDSAReportRelatedReportsConnection( + ctx.mongo, + ctx.tenant.id, + submissionID, + id, + { + first: defaultTo(first, 10), + orderBy: defaultTo(orderBy, GQLREPORT_SORT.CREATED_AT_DESC), + } + ), }); diff --git a/server/src/core/server/graph/resolvers/DSAReport.ts b/server/src/core/server/graph/resolvers/DSAReport.ts index a479aebdfa..17ac248b6b 100644 --- a/server/src/core/server/graph/resolvers/DSAReport.ts +++ b/server/src/core/server/graph/resolvers/DSAReport.ts @@ -1,6 +1,11 @@ +import { defaultTo } from "lodash"; + import * as dsaReport from "coral-server/models/dsaReport"; -import { GQLDSAReportTypeResolver } from "coral-server/graph/schema/__generated__/types"; +import { + GQLDSAReportTypeResolver, + GQLREPORT_SORT, +} from "coral-server/graph/schema/__generated__/types"; export const DSAReport: GQLDSAReportTypeResolver = { reporter: (report, args, ctx) => { @@ -33,4 +38,11 @@ export const DSAReport: GQLDSAReportTypeResolver = { return null; } }, + relatedReports: ({ submissionID, id }, { first, after, orderBy }, ctx) => { + return ctx.loaders.DSAReports.relatedReports(submissionID, id, { + first: defaultTo(first, 10), + after, + orderBy: defaultTo(orderBy, GQLREPORT_SORT.CREATED_AT_DESC), + }); + }, }; diff --git a/server/src/core/server/graph/schema/schema.graphql b/server/src/core/server/graph/schema/schema.graphql index c2ab69385a..d9a4e0b8e7 100644 --- a/server/src/core/server/graph/schema/schema.graphql +++ b/server/src/core/server/graph/schema/schema.graphql @@ -3661,6 +3661,12 @@ type DSAReport { such as a note added, status changed, or decision made """ lastUpdated: Time + + relatedReports( + first: Int = 10 @constraint(max: 50) + orderBy: REPORT_SORT = CREATED_AT_DESC + after: Cursor + ): DSAReportsConnection! } type CommentRevisionPerspectiveMetadata { diff --git a/server/src/core/server/models/dsaReport/report.ts b/server/src/core/server/models/dsaReport/report.ts index 4261b705a0..4b5b6d18a2 100644 --- a/server/src/core/server/models/dsaReport/report.ts +++ b/server/src/core/server/models/dsaReport/report.ts @@ -167,6 +167,23 @@ export async function retrieveDSAReportConnection( return retrieveConnection(input, query); } +export async function retrieveDSAReportRelatedReportsConnection( + mongo: MongoContext, + tenantID: string, + submissionID: string, + id: string, + input: DSAReportConnectionInput +): Promise>>> { + // Create the query. + const query = new Query(mongo.dsaReports()).where({ + tenantID, + submissionID, + id: { $ne: id }, + }); + + return retrieveConnection(input, query); +} + export async function retrieveDSAReport( mongo: MongoContext, tenantID: string, From 8f2a772a6e88d4a22bf9261dedfd3bf4836e67ee Mon Sep 17 00:00:00 2001 From: Kathryn Beaty Date: Mon, 27 Nov 2023 13:26:22 -0500 Subject: [PATCH 09/29] add comment; update default --- .../src/core/client/admin/routes/Reports/RelatedReports.tsx | 2 +- server/src/core/server/graph/loaders/DSAReports.ts | 3 ++- server/src/core/server/graph/schema/schema.graphql | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/core/client/admin/routes/Reports/RelatedReports.tsx b/client/src/core/client/admin/routes/Reports/RelatedReports.tsx index d647fecc13..5b3c22c08a 100644 --- a/client/src/core/client/admin/routes/Reports/RelatedReports.tsx +++ b/client/src/core/client/admin/routes/Reports/RelatedReports.tsx @@ -64,7 +64,7 @@ const enhanced = withFragmentContainer({ dsaReport: graphql` fragment RelatedReports_dsaReport on DSAReport @argumentDefinitions( - count: { type: "Int", defaultValue: 20 } + count: { type: "Int", defaultValue: 10 } cursor: { type: "Cursor" } orderBy: { type: "REPORT_SORT", defaultValue: CREATED_AT_DESC } ) { diff --git a/server/src/core/server/graph/loaders/DSAReports.ts b/server/src/core/server/graph/loaders/DSAReports.ts index e21a65827d..fad47e0d4a 100644 --- a/server/src/core/server/graph/loaders/DSAReports.ts +++ b/server/src/core/server/graph/loaders/DSAReports.ts @@ -58,7 +58,7 @@ export default (ctx: GraphContext) => ({ relatedReports: ( submissionID: string, id: string, - { first, orderBy }: DSAReportToRelatedReportsArgs + { first, orderBy, after }: DSAReportToRelatedReportsArgs ) => retrieveDSAReportRelatedReportsConnection( ctx.mongo, @@ -68,6 +68,7 @@ export default (ctx: GraphContext) => ({ { first: defaultTo(first, 10), orderBy: defaultTo(orderBy, GQLREPORT_SORT.CREATED_AT_DESC), + after, } ), }); diff --git a/server/src/core/server/graph/schema/schema.graphql b/server/src/core/server/graph/schema/schema.graphql index d9a4e0b8e7..79dae534c9 100644 --- a/server/src/core/server/graph/schema/schema.graphql +++ b/server/src/core/server/graph/schema/schema.graphql @@ -3662,6 +3662,10 @@ type DSAReport { """ lastUpdated: Time + """ + relatedReports are DSAReports that share a submissionID and were submitted at the same time + in one illegal content report + """ relatedReports( first: Int = 10 @constraint(max: 50) orderBy: REPORT_SORT = CREATED_AT_DESC From 98e0407077fc6a1487c83a871289934fd2bc409d Mon Sep 17 00:00:00 2001 From: Kathryn Beaty Date: Mon, 27 Nov 2023 13:36:26 -0500 Subject: [PATCH 10/29] update test fixtures --- client/src/core/client/admin/test/fixtures.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/core/client/admin/test/fixtures.ts b/client/src/core/client/admin/test/fixtures.ts index 6c07e261db..fe5283f553 100644 --- a/client/src/core/client/admin/test/fixtures.ts +++ b/client/src/core/client/admin/test/fixtures.ts @@ -851,6 +851,7 @@ export const dsaReports = createFixtures([ additionalInformation: "The additional information supporting why that law is alleged to have been broken", history: [], + relatedReports: { edges: [], pageInfo: { hasNextPage: false } }, }, { id: "dsa-report-2", @@ -869,6 +870,7 @@ export const dsaReports = createFixtures([ "A detailed explanation of why it is a violation of Law number 2", }, history: [], + relatedReports: { edges: [], pageInfo: { hasNextPage: false } }, }, ]); From 752a8eb9769cc4943c30e95f3e3d4aab54e03da2 Mon Sep 17 00:00:00 2001 From: Kathryn Beaty Date: Mon, 27 Nov 2023 15:26:00 -0500 Subject: [PATCH 11/29] update csv info for timestamp and comment media --- .../src/core/server/locales/en-US/common.ftl | 3 +- .../server/services/dsaReports/download.ts | 85 +++++++++++-------- 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/server/src/core/server/locales/en-US/common.ftl b/server/src/core/server/locales/en-US/common.ftl index fb925bf81f..4a0d6a371e 100644 --- a/server/src/core/server/locales/en-US/common.ftl +++ b/server/src/core/server/locales/en-US/common.ftl @@ -19,7 +19,7 @@ comment-counts-ratings-and-reviews = staff-label = Staff -dsaReportCSV-timestamp = Timestamp +dsaReportCSV-timestamp = Timestamp (UTC) dsaReportCSV-user = User dsaReportCSV-action = Action dsaReportCSV-details = Details @@ -30,6 +30,7 @@ dsaReportCSV-additionalInfo = Additional info dsaReportCSV-commentAuthor = Comment author dsaReportCSV-commentBody = Comment body dsaReportCSV-commentID = Comment ID +dsaReportCSV-commentMediaUrl = Comment media url dsaReportCSV-changedStatus = Changed status dsaReportCSV-addedNote = Added note dsaReportCSV-madeDecision = Made decision diff --git a/server/src/core/server/services/dsaReports/download.ts b/server/src/core/server/services/dsaReports/download.ts index 8b290b0be2..a4cc7dd54c 100644 --- a/server/src/core/server/services/dsaReports/download.ts +++ b/server/src/core/server/services/dsaReports/download.ts @@ -90,51 +90,62 @@ export async function sendReportDownload( } csv.write([ - translate(bundle, "Timestamp", "dsaReportCSV-timestamp"), + translate(bundle, "Timestamp (UTC)", "dsaReportCSV-timestamp"), translate(bundle, "User", "dsaReportCSV-user"), translate(bundle, "Action", "dsaReportCSV-action"), translate(bundle, "Details", "dsaReportCSV-details"), ]); + + // Set up default report info cell + let reportInfo = `${translate( + bundle, + "Reference ID", + "dsaReportCSV-referenceID" + )}: ${report.referenceID}\n${translate( + bundle, + "Legal detail", + "dsaReportCSV-legalDetail" + )}: ${report.lawBrokenDescription}\n${translate( + bundle, + "Additional info", + "dsaReportCSV-additionalInfo" + )}: ${report.additionalInformation}`; + + // Add reported comment info to report info cell if available if (reportedComment && report.status !== GQLDSAReportStatus.VOID) { - csv.write([ - formatter.format(report.createdAt), - reporter?.username, - translate(bundle, "Report submitted", "dsaReportCSV-reportSubmitted"), - `${translate(bundle, "Reference ID", "dsaReportCSV-referenceID")}: ${ - report.referenceID - }\n${translate(bundle, "Legal detail", "dsaReportCSV-legalDetail")}: ${ - report.lawBrokenDescription - }\n${translate( - bundle, - "Additional info", - "dsaReportCSV-additionalInfo" - )}: ${report.additionalInformation}\n${translate( + reportInfo += `\n${translate( + bundle, + "Comment author", + "dsaReportCSV-commentAuthor" + )}: ${reportedCommentAuthorUsername}\n${translate( + bundle, + "Comment body", + "dsaReportCSV-commentBody" + )}: ${reportedComment.revisions[0].body}\n${translate( + bundle, + "Comment ID", + "dsaReportCSV-commentID" + )}: ${reportedComment.id}`; + + // Add in comment media url if present + const commentMediaUrl = reportedComment.revisions[0].media?.url; + if (commentMediaUrl) { + reportInfo += `\n${translate( bundle, - "Comment author", - "dsaReportCSV-commentAuthor" - )}: ${reportedCommentAuthorUsername}\nComment body: ${ - reportedComment.revisions[0].body - }\n${translate(bundle, "Comment ID", "dsaReportCSV-commentID")}: ${ - reportedComment.id - }`, - ]); - } else { - csv.write([ - formatter.format(report.createdAt), - reporter?.username, - translate(bundle, "Report submitted", "dsaReportCSV-reportSubmitted"), - `${translate(bundle, "Reference ID", "dsaReportCSV-referenceID")}: ${ - report.referenceID - }\n${translate(bundle, "Legal detail", "dsaReportCSV-legalDetail")}: ${ - report.lawBrokenDescription - }\n${translate( - bundle, - "Additional info", - "dsaReportCSV-additionalInfo" - )}: ${report.additionalInformation}`, - ]); + "Comment media url", + "dsaReportCSV-commentMediaUrl" + )}: ${commentMediaUrl}`; + } } + // Write report info cell data to CSV + csv.write([ + formatter.format(report.createdAt), + reporter?.username, + translate(bundle, "Report submitted", "dsaReportCSV-reportSubmitted"), + reportInfo, + ]); + if (report.history) { const getStatusText = (status: GQLDSAReportStatus) => { const mapping = { From fbf51c41ce264ed5bb594c5c300a56798eacbf26 Mon Sep 17 00:00:00 2001 From: Kathryn Beaty Date: Tue, 28 Nov 2023 09:32:51 -0500 Subject: [PATCH 12/29] add customReason for Other rejection reason --- .../ModerationReason/DetailedExplanation.tsx | 43 +++++++++++++++---- .../ModerationReason/ModerationReason.tsx | 20 +++++++-- .../configure/streamConfiguration.spec.tsx | 2 +- locales/en-US/common.ftl | 3 ++ .../core/server/graph/schema/schema.graphql | 10 +++++ .../models/action/moderation/comment.ts | 1 + .../src/core/server/stacks/rejectComment.ts | 1 + 7 files changed, 67 insertions(+), 13 deletions(-) diff --git a/client/src/core/client/admin/components/ModerationReason/DetailedExplanation.tsx b/client/src/core/client/admin/components/ModerationReason/DetailedExplanation.tsx index 8c9ec0774a..1efcc1e8e5 100644 --- a/client/src/core/client/admin/components/ModerationReason/DetailedExplanation.tsx +++ b/client/src/core/client/admin/components/ModerationReason/DetailedExplanation.tsx @@ -13,9 +13,11 @@ import styles from "./DetailedExplanation.css"; import commonStyles from "./ModerationReason.css"; export interface Props { - onChange: (value: string) => void; + onChangeExplanation: (value: string) => void; + onChangeCustomReason: (value: string) => void; code: GQLREJECTION_REASON_CODE; - value: string | null; + explanationValue: string | null; + customReasonValue: string | null; onBack: () => void; } @@ -36,9 +38,11 @@ const AddExplanationButton: FunctionComponent<{ onClick: () => void }> = ({ const DetailedExplanation: FunctionComponent = ({ code, - value, - onChange, + explanationValue, + onChangeExplanation, onBack, + customReasonValue, + onChangeCustomReason, }) => { const [showAddExplanation, setShowAddExplanation] = useState( !!(code === GQLREJECTION_REASON_CODE.OTHER) @@ -48,7 +52,7 @@ const DetailedExplanation: FunctionComponent = ({ <> @@ -60,13 +64,36 @@ const DetailedExplanation: FunctionComponent = ({
{unsnake(code)}
+ {code === GQLREJECTION_REASON_CODE.OTHER && ( + <> + + + + +