Merge pull request 'Merge upstream 2025-01-12' (#29) from sugar/forkey:merge-upstream-2025-01-12 into main
Some checks failed
API report (misskey.js) / report (push) Successful in 2m19s
Lint / pnpm_install (push) Successful in 2m19s
Test (misskey.js) / test (22.x) (push) Successful in 2m29s
Test (production install and build) / production (22.x) (push) Successful in 2m58s
Test (backend) / validate-api-json (22.x) (push) Successful in 3m16s
Lint / lint (backend) (push) Successful in 3m40s
Lint / lint (frontend) (push) Successful in 9m36s
Lint / lint (misskey-js) (push) Successful in 2m33s
Lint / lint (sw) (push) Successful in 2m18s
Lint / typecheck (backend) (push) Successful in 3m14s
Lint / typecheck (misskey-js) (push) Successful in 2m27s
Test (backend) / unit (22.x) (push) Successful in 7m10s
Test (backend) / e2e (22.x) (push) Failing after 8m30s

Reviewed-on: #29
Reviewed-by: leah <leah@noreply.woem.men>
This commit is contained in:
sugar 2025-01-17 15:28:37 +00:00
commit 6b4f96a94b
12 changed files with 53 additions and 44 deletions

View file

@ -58,9 +58,9 @@ export class ChartManagementService implements OnApplicationShutdown {
@bindThis @bindThis
public async start() { public async start() {
// 20分おきにメモリ情報をDBに書き込み // 20分おきにメモリ情報をDBに書き込み
this.saveIntervalId = setInterval(() => { this.saveIntervalId = setInterval(async () => {
for (const chart of this.charts) { for (const chart of this.charts) {
chart.save(); await chart.save();
} }
}, 1000 * 60 * 20); }, 1000 * 60 * 20);
} }
@ -69,9 +69,9 @@ export class ChartManagementService implements OnApplicationShutdown {
public async dispose(): Promise<void> { public async dispose(): Promise<void> {
clearInterval(this.saveIntervalId); clearInterval(this.saveIntervalId);
if (process.env.NODE_ENV !== 'test') { if (process.env.NODE_ENV !== 'test') {
await Promise.all( for (const chart of this.charts) {
this.charts.map(chart => chart.save()), await chart.save();
); }
} }
} }

View file

@ -48,20 +48,18 @@ export class CleanChartsProcessorService {
public async process(): Promise<void> { public async process(): Promise<void> {
this.logger.info('Clean charts...'); this.logger.info('Clean charts...');
await Promise.all([ await this.federationChart.clean();
this.federationChart.clean(), await this.notesChart.clean();
this.notesChart.clean(), await this.usersChart.clean();
this.usersChart.clean(), await this.activeUsersChart.clean();
this.activeUsersChart.clean(), await this.instanceChart.clean();
this.instanceChart.clean(), await this.perUserNotesChart.clean();
this.perUserNotesChart.clean(), await this.perUserPvChart.clean();
this.perUserPvChart.clean(), await this.driveChart.clean();
this.driveChart.clean(), await this.perUserReactionsChart.clean();
this.perUserReactionsChart.clean(), await this.perUserFollowingChart.clean();
this.perUserFollowingChart.clean(), await this.perUserDriveChart.clean();
this.perUserDriveChart.clean(), await this.apRequestChart.clean();
this.apRequestChart.clean(),
]);
this.logger.succ('All charts successfully cleaned.'); this.logger.succ('All charts successfully cleaned.');
} }

View file

@ -31,11 +31,9 @@ export class ResyncChartsProcessorService {
// TODO: ユーザーごとのチャートも更新する // TODO: ユーザーごとのチャートも更新する
// TODO: インスタンスごとのチャートも更新する // TODO: インスタンスごとのチャートも更新する
await Promise.all([ await this.driveChart.resync();
this.driveChart.resync(), await this.notesChart.resync();
this.notesChart.resync(), await this.usersChart.resync();
this.usersChart.resync(),
]);
this.logger.succ('All charts successfully resynced.'); this.logger.succ('All charts successfully resynced.');
} }

View file

@ -48,20 +48,18 @@ export class TickChartsProcessorService {
public async process(): Promise<void> { public async process(): Promise<void> {
this.logger.info('Tick charts...'); this.logger.info('Tick charts...');
await Promise.all([ await this.federationChart.tick(false);
this.federationChart.tick(false), await this.notesChart.tick(false);
this.notesChart.tick(false), await this.usersChart.tick(false);
this.usersChart.tick(false), await this.activeUsersChart.tick(false);
this.activeUsersChart.tick(false), await this.instanceChart.tick(false);
this.instanceChart.tick(false), await this.perUserNotesChart.tick(false);
this.perUserNotesChart.tick(false), await this.perUserPvChart.tick(false);
this.perUserPvChart.tick(false), await this.driveChart.tick(false);
this.driveChart.tick(false), await this.perUserReactionsChart.tick(false);
this.perUserReactionsChart.tick(false), await this.perUserFollowingChart.tick(false);
this.perUserFollowingChart.tick(false), await this.perUserDriveChart.tick(false);
this.perUserDriveChart.tick(false), await this.apRequestChart.tick(false);
this.apRequestChart.tick(false),
]);
this.logger.succ('All charts successfully ticked.'); this.logger.succ('All charts successfully ticked.');
} }

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

@ -298,7 +298,7 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: IRouter
const { canceled: canceled3, result: memo } = await os.inputText({ const { canceled: canceled3, result: memo } = await os.inputText({
title: i18n.ts.addMemo, title: i18n.ts.addMemo,
type: 'textarea', type: 'textarea',
placeholder: i18n.ts.memo, default: '',
}); });
if (canceled3) return; if (canceled3) return;

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) {