add report selection via url hash
All checks were successful
delpoy / build-and-deploy (push) Successful in 48s
All checks were successful
delpoy / build-and-deploy (push) Successful in 48s
This commit is contained in:
@@ -22,9 +22,11 @@ export const POST = (async ({ request, cookies }) => {
|
||||
status: 'none' | 'review' | 'reviewed' | null;
|
||||
reporter: string | null;
|
||||
reported: string | null;
|
||||
|
||||
hash: string | null;
|
||||
} = await request.json();
|
||||
|
||||
const reportFindOptions: Attributes<Report> = {};
|
||||
let reportFindOptions: Attributes<Report> = {};
|
||||
if (data.draft != null) reportFindOptions.draft = data.draft;
|
||||
reportFindOptions.status = data.status == null ? ['none', 'review'] : data.status;
|
||||
if (data.reporter != null) {
|
||||
@@ -41,6 +43,13 @@ export const POST = (async ({ request, cookies }) => {
|
||||
});
|
||||
reportFindOptions.reported_id = reported_ids.map((u) => u.id);
|
||||
}
|
||||
|
||||
if (data.hash != null) {
|
||||
reportFindOptions = { url_hash: data.hash };
|
||||
data.from = 0;
|
||||
data.limit = 1;
|
||||
}
|
||||
|
||||
let reports = await Report.findAll({
|
||||
where: reportFindOptions,
|
||||
include: [
|
||||
|
||||
Reference in New Issue
Block a user