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 = {