Compare commits

...

2 commits

Author SHA1 Message Date
d4a5ed29db
server: return report id when reporting
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline failed
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/build Pipeline failed
ci/woodpecker/push/test unknown status
ci/woodpecker/push/lint-backend Pipeline failed
This can be useful when adding a feature for admins and moderators
where they will be able to immediately deal with their own report,
i.e. forwarding it to the other instance.

Changelog: Added
2024-02-19 08:19:23 +01:00
fba8536743
stop retries after wrong content-type
It does not make sense to re-request the same resource with the same
parameters and expect a different content-type to be returned. Also
this makes the error message more sensible and understandable.
2024-02-19 07:50:19 +01:00
2 changed files with 19 additions and 2 deletions

View file

@ -121,9 +121,10 @@ export async function signedGet(_url: string, user: { id: User['id'] }): Promise
return false;
};
if (isActivitypub(res.headers.get('Content-Type'))) {
return await res.json();
if (!isActivitypub(res.headers.get('Content-Type'))) {
throw new Error('invalid response content type');
}
return await res.json();
}
}

View file

@ -16,6 +16,20 @@ export const meta = {
description: 'File a report.',
res: {
type: 'object',
optional: false,
required: true,
properties: {
id: {
type: 'string',
format: 'misskey:id',
optional: false,
nullable: false,
},
}
}
errors: ['NO_SUCH_USER', 'CANNOT_REPORT_ADMIN', 'CANNOT_REPORT_YOURSELF'],
} as const;
@ -81,4 +95,6 @@ export default define(meta, paramDef, async (ps, me) => {
sanitizeHtml(ps.comment));
}
});
return { id: report.id };
});