mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-22 05:55:12 +00:00
return error when calling following feed with both includeReplies and filesOnly
This commit is contained in:
parent
6430a191f7
commit
053b47d78a
1 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,14 @@ export const meta = {
|
||||||
ref: 'Note',
|
ref: 'Note',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
bothWithRepliesAndWithFiles: {
|
||||||
|
message: 'Specifying both includeReplies and filesOnly is not supported',
|
||||||
|
code: 'BOTH_INCLUDE_REPLIES_AND_FILES_ONLY',
|
||||||
|
id: '91c8cb9f-36ed-46e7-9ca2-7df96ed6e222',
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -58,6 +66,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private queryService: QueryService,
|
private queryService: QueryService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
if (ps.includeReplies && ps.filesOnly) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles);
|
||||||
|
|
||||||
const query = this.notesRepository
|
const query = this.notesRepository
|
||||||
.createQueryBuilder('note')
|
.createQueryBuilder('note')
|
||||||
.setParameter('me', me.id)
|
.setParameter('me', me.id)
|
||||||
|
|
Loading…
Reference in a new issue