Merge upstream 2025-01-12 #29

Merged
sugar merged 5 commits from sugar/forkey:merge-upstream-2025-01-12 into main 2025-01-17 15:28:38 +00:00
7 changed files with 20 additions and 5 deletions
Showing only changes of commit 1683945e78 - Show all commits

View file

@ -40,7 +40,7 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: true, nullable: false,
properties: { properties: {
createdNote: { createdNote: {
type: 'object', type: 'object',
@ -207,6 +207,7 @@ export const paramDef = {
}, },
required: ['choices'], required: ['choices'],
}, },
noCreatedNote: { type: 'boolean', default: false },
}, },
// (re)note with text, files and poll are optional // (re)note with text, files and poll are optional
if: { if: {
@ -281,7 +282,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const note = await this.notesRepository.findOneBy({ id: idempotent }); const note = await this.notesRepository.findOneBy({ id: idempotent });
if (note) { if (note) {
logger.info('The request has already been processed.', { noteId: note.id }); 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); await this.redisForTimelines.set(`note:idempotent:${me.id}:${hash}`, note.id, 'EX', 60);
logger.info('Successfully created a note.', { noteId: note.id }); logger.info('Successfully created a note.', { noteId: note.id });
return { if (ps.noCreatedNote) return;
else return {
createdNote: await this.noteEntityService.pack(note, me), createdNote: await this.noteEntityService.pack(note, me),
}; };
} catch (err) { } catch (err) {

View file

@ -41,7 +41,8 @@ window.onload = async () => {
document.getElementById('submit').addEventListener('click', () => { document.getElementById('submit').addEventListener('click', () => {
api('notes/create', { api('notes/create', {
text: document.getElementById('text').value text: document.getElementById('text').value,
noCreatedNote: true,
}).then(() => { }).then(() => {
location.reload(); location.reload();
}); });

View file

@ -798,6 +798,7 @@ async function post(ev?: MouseEvent) {
visibility: visibility.value, visibility: visibility.value,
visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined, visibleUserIds: visibility.value === 'specified' ? visibleUsers.value.map(u => u.id) : undefined,
reactionAcceptance: reactionAcceptance.value, reactionAcceptance: reactionAcceptance.value,
noCreatedNote: true,
}; };
if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') { if (withHashtags.value && hashtags.value && hashtags.value.trim() !== '') {

View file

@ -46,6 +46,7 @@ function start(_game: Misskey.entities.ReversiGameDetailed) {
misskeyApi('notes/create', { misskeyApi('notes/create', {
text: i18n.ts._reversi.iStartedAGame + '\n' + location.href, text: i18n.ts._reversi.iStartedAGame + '\n' + location.href,
visibility: 'home', visibility: 'home',
noCreatedNote: true,
}); });
} }

View file

@ -543,6 +543,7 @@ export function getRenoteMenu(props: {
misskeyApi('notes/create', { misskeyApi('notes/create', {
renoteId: appearNote.id, renoteId: appearNote.id,
channelId: appearNote.channelId, channelId: appearNote.channelId,
noCreatedNote: true,
}).then(() => { }).then(() => {
os.toast(i18n.ts.renoted); os.toast(i18n.ts.renoted);
}); });
@ -589,6 +590,7 @@ export function getRenoteMenu(props: {
localOnly, localOnly,
visibility, visibility,
renoteId: appearNote.id, renoteId: appearNote.id,
noCreatedNote: true,
}).then(() => { }).then(() => {
os.toast(i18n.ts.renoted); os.toast(i18n.ts.renoted);
}); });
@ -630,6 +632,7 @@ export function getRenoteMenu(props: {
misskeyApi('notes/create', { misskeyApi('notes/create', {
renoteId: appearNote.id, renoteId: appearNote.id,
channelId: channel.id, channelId: channel.id,
noCreatedNote: true,
}).then(() => { }).then(() => {
os.toast(i18n.tsx.renotedToX({ name: channel.name })); os.toast(i18n.tsx.renotedToX({ name: channel.name }));
}); });

View file

@ -23465,6 +23465,8 @@ export type operations = {
expiresAt?: number | null; expiresAt?: number | null;
expiredAfter?: number | null; expiredAfter?: number | null;
}) | null; }) | null;
/** @default false */
noCreatedNote?: boolean;
}; };
}; };
}; };
@ -23477,6 +23479,10 @@ export type operations = {
}; };
}; };
}; };
/** @description OK (without any results) */
204: {
content: never;
};
/** @description Client error */ /** @description Client error */
400: { 400: {
content: { content: {

View file

@ -114,7 +114,7 @@ globalThis.addEventListener('notificationclick', (ev: ServiceWorkerGlobalScopeEv
if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId); if ('note' in data.body) client = await swos.openPost({ reply: data.body.note }, loginId);
break; break;
case 'renote': 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; break;
case 'accept': case 'accept':
switch (data.body.type) { switch (data.body.type) {