forked from administration/panel
chore: make cased reports go away
parent
5cdb02b5bf
commit
7f1619d33a
|
@ -30,6 +30,8 @@ export default async function Reports() {
|
|||
}
|
||||
|
||||
for (const report of reports) {
|
||||
if (report.case_id) continue;
|
||||
|
||||
if (!report.content.report_reason.includes("Illegal")) {
|
||||
if (countsByAuthor[report.author_id] > 1) {
|
||||
if (!keyOrder.includes(report.author_id)) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Report } from "revolt-api";
|
||||
import { Card, CardDescription, CardHeader, CardTitle } from "../ui/card";
|
||||
import { Badge } from "../ui/badge";
|
||||
import dayjs from "dayjs";
|
||||
import { decodeTime } from "ulid";
|
||||
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
import { ReportDocument } from "@/lib/db";
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const lastWeek = new Date();
|
||||
|
@ -13,7 +13,7 @@ lastWeek.setDate(lastWeek.getDate() - 7);
|
|||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
|
||||
export function ReportCard({ report }: { report: Report }) {
|
||||
export function ReportCard({ report }: { report: ReportDocument }) {
|
||||
const dueDate = +(report.content.report_reason.includes("Illegal")
|
||||
? yesterday
|
||||
: lastWeek);
|
||||
|
@ -48,6 +48,14 @@ export function ReportCard({ report }: { report: Report }) {
|
|||
{report.status !== "Created" && report.closed_at && (
|
||||
<>· Closed {dayjs(report.closed_at).fromNow()}</>
|
||||
)}{" "}
|
||||
{report.case_id && (
|
||||
<>
|
||||
·{" "}
|
||||
<Badge className="align-middle" variant="secondary">
|
||||
Assigned
|
||||
</Badge>
|
||||
</>
|
||||
)}{" "}
|
||||
{report.status === "Created" && decodeTime(report._id) < dueDate && (
|
||||
<>
|
||||
·{" "}
|
||||
|
|
Loading…
Reference in New Issue