@@ -40,7 +40,7 @@ export const meta = {
40
40
41
41
res : {
42
42
type : 'object' ,
43
- optional : false , nullable : false ,
43
+ optional : true , nullable : false ,
44
44
properties : {
45
45
createdNote : {
46
46
type : 'object' ,
@@ -207,6 +207,7 @@ export const paramDef = {
207
207
} ,
208
208
required : [ 'choices' ] ,
209
209
} ,
210
+ noCreatedNote : { type : 'boolean' , default : false } ,
210
211
} ,
211
212
// (re)note with text, files and poll are optional
212
213
if : {
@@ -281,7 +282,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
281
282
const note = await this . notesRepository . findOneBy ( { id : idempotent } ) ;
282
283
if ( note ) {
283
284
logger . info ( 'The request has already been processed.' , { noteId : note . id } ) ;
284
- return { createdNote : await this . noteEntityService . pack ( note , me ) } ;
285
+ if ( ps . noCreatedNote ) return ;
286
+ else return { createdNote : await this . noteEntityService . pack ( note , me ) } ;
285
287
}
286
288
}
287
289
@@ -453,7 +455,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
453
455
await this . redisForTimelines . set ( `note:idempotent:${ me . id } :${ hash } ` , note . id , 'EX' , 60 ) ;
454
456
455
457
logger . info ( 'Successfully created a note.' , { noteId : note . id } ) ;
456
- return {
458
+ if ( ps . noCreatedNote ) return ;
459
+ else return {
457
460
createdNote : await this . noteEntityService . pack ( note , me ) ,
458
461
} ;
459
462
} catch ( err ) {
0 commit comments