spec(notes/create): 投稿されたnoteを返さないオプションを追加 (MisskeyIO#879)
This commit is contained in:
parent
2de6c63dcb
commit
1683945e78
7 changed files with 20 additions and 5 deletions
|
@ -40,7 +40,7 @@ export const meta = {
|
|||
|
||||
res: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
optional: true, nullable: false,
|
||||
properties: {
|
||||
createdNote: {
|
||||
type: 'object',
|
||||
|
@ -207,6 +207,7 @@ export const paramDef = {
|
|||
},
|
||||
required: ['choices'],
|
||||
},
|
||||
noCreatedNote: { type: 'boolean', default: false },
|
||||
},
|
||||
// (re)note with text, files and poll are optional
|
||||
if: {
|
||||
|
@ -281,7 +282,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
const note = await this.notesRepository.findOneBy({ id: idempotent });
|
||||
if (note) {
|
||||
logger.info('The request has already been processed.', { noteId: note.id });
|
||||
return { createdNote: await this.noteEntityService.pack(note, me) };
|
||||
if (ps.noCreatedNote) return;
|
||||
else return { createdNote: await this.noteEntityService.pack(note, me) };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,7 +455,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
await this.redisForTimelines.set(`note:idempotent:${me.id}:${hash}`, note.id, 'EX', 60);
|
||||
|
||||
logger.info('Successfully created a note.', { noteId: note.id });
|
||||
return {
|
||||
if (ps.noCreatedNote) return;
|
||||
else return {
|
||||
createdNote: await this.noteEntityService.pack(note, me),
|
||||
};
|
||||
} catch (err) {
|
||||
|
|
|
@ -41,7 +41,8 @@ window.onload = async () => {
|
|||
|
||||
document.getElementById('submit').addEventListener('click', () => {
|
||||
api('notes/create', {
|
||||
text: document.getElementById('text').value
|
||||
text: document.getElementById('text').value,
|
||||
noCreatedNote: true,
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
});
|
||||
|
|
|
@ -798,6 +798,7 @@ async function post(ev?: MouseEvent) {
|
|||
visibility: visibility.value,
|
||||
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined,
|
||||
reactionAcceptance: reactionAcceptance.value,
|
||||
noCreatedNote: true,
|
||||
};
|
||||
|
||||
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') {
|
||||
|
|
|
@ -46,6 +46,7 @@ function start(_game: Misskey.entities.ReversiGameDetailed) {
|
|||
misskeyApi('notes/create', {
|
||||
text: i18n.ts._reversi.iStartedAGame + '\n' + location.href,
|
||||
visibility: 'home',
|
||||
noCreatedNote: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -543,6 +543,7 @@ export function getRenoteMenu(props: {
|
|||
misskeyApi('notes/create', {
|
||||
renoteId: appearNote.id,
|
||||
channelId: appearNote.channelId,
|
||||
noCreatedNote: true,
|
||||
}).then(() => {
|
||||
os.toast(i18n.ts.renoted);
|
||||
});
|
||||
|
@ -589,6 +590,7 @@ export function getRenoteMenu(props: {
|
|||
localOnly,
|
||||
visibility,
|
||||
renoteId: appearNote.id,
|
||||
noCreatedNote: true,
|
||||
}).then(() => {
|
||||
os.toast(i18n.ts.renoted);
|
||||
});
|
||||
|
@ -630,6 +632,7 @@ export function getRenoteMenu(props: {
|
|||
misskeyApi('notes/create', {
|
||||
renoteId: appearNote.id,
|
||||
channelId: channel.id,
|
||||
noCreatedNote: true,
|
||||
}).then(() => {
|
||||
os.toast(i18n.tsx.renotedToX({ name: channel.name }));
|
||||
});
|
||||
|
|
|
@ -23465,6 +23465,8 @@ export type operations = {
|
|||
expiresAt?: number | null;
|
||||
expiredAfter?: number | null;
|
||||
}) | null;
|
||||
/** @default false */
|
||||
noCreatedNote?: boolean;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -23477,6 +23479,10 @@ export type operations = {
|
|||
};
|
||||
};
|
||||
};
|
||||
/** @description OK (without any results) */
|
||||
204: {
|
||||
content: never;
|
||||
};
|
||||
/** @description Client error */
|
||||
400: {
|
||||
content: {
|
||||
|
|
|
@ -114,7 +114,7 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv
|
|||
if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId);
|
||||
break;
|
||||
case 'renote':
|
||||
if ('note' in data.body) await swos.api('notes/create', loginId, { renoteId: data.body.note.id });
|
||||
if ('note' in data.body) await swos.api('notes/create', loginId, { renoteId: data.body.note.id, noCreatedNote: true });
|
||||
break;
|
||||
case 'accept':
|
||||
switch (data.body.type) {
|
||||
|
|
Loading…
Reference in a new issue