From fe16b5453b218989583cec8e97942850333d2fe4 Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:58:45 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=E6=94=AF=E6=8F=B4=E8=80=85=E6=95=B0?= =?UTF-8?q?=E3=81=8C=E6=AD=A3=E3=81=97=E3=81=8F=E8=A1=A8=E7=A4=BA=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/core/integrations/FanboxManagementService.ts | 2 +- .../backend/src/core/integrations/PatreonManagementService.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/integrations/FanboxManagementService.ts b/packages/backend/src/core/integrations/FanboxManagementService.ts index 7dbdfe138b31..56604df306b6 100644 --- a/packages/backend/src/core/integrations/FanboxManagementService.ts +++ b/packages/backend/src/core/integrations/FanboxManagementService.ts @@ -128,7 +128,7 @@ export class FanboxManagementService implements OnApplicationShutdown { }); } - this.logger.info(`Found ${Object.keys(usersList).length} fanbox supporter(s)`); + this.logger.info(`Found ${usersList.size} fanbox supporter(s)`); this.logger.info('Cache updated.'); } catch (err: any) { this.logger.error('Failed to update fanbox supporter cache'); diff --git a/packages/backend/src/core/integrations/PatreonManagementService.ts b/packages/backend/src/core/integrations/PatreonManagementService.ts index 27826d547676..1641a1abad65 100644 --- a/packages/backend/src/core/integrations/PatreonManagementService.ts +++ b/packages/backend/src/core/integrations/PatreonManagementService.ts @@ -136,7 +136,7 @@ export class PatreonManagementService implements OnApplicationShutdown { }); } - this.logger.info(`Found ${Object.keys(usersList).length} patreon(s)`); + this.logger.info(`Found ${usersList.size} patreon(s)`); } catch (err: any) { this.logger.error('Failed to fetch patreon users'); this.logger.error(err); From 453dd4b7676e923360e85ba4215938894855c43d Mon Sep 17 00:00:00 2001 From: yukineko <27853966+hideki0403@users.noreply.github.com> Date: Fri, 12 Apr 2024 02:09:45 +0900 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20=E6=99=82=E9=99=90=E3=83=8E?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=81=A71=E5=B9=B4=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=E5=BE=8C=E3=81=AE=E6=97=A5=E6=99=82=E3=82=92=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/index.d.ts | 4 + locales/ja-JP.yml | 1 + .../src/server/api/endpoints/notes/create.ts | 10 +++ .../src/components/MkDeleteScheduleEditor.vue | 79 ++++++++++++------- .../frontend/src/components/MkPostForm.vue | 3 + 5 files changed, 67 insertions(+), 30 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 6d1a56535641..e9850724a6a1 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5272,6 +5272,10 @@ export interface Locale extends ILocale { * このノートは{time}に消滅します */ "noteDeletationAt": ParameterizedString<"time">; + /** + * 1年以上先の日時を指定することはできません + */ + "cannotScheduleLaterThanOneYear": string; /** * アクティビティを非公開にする */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c0fc642cec25..7bc4455582dd 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1314,6 +1314,7 @@ surrender: "やめる" gameRetry: "リトライ" scheduledNoteDelete: "ノートの自己消滅" noteDeletationAt: "このノートは{time}に消滅します" +cannotScheduleLaterThanOneYear: "1年以上先の日時を指定することはできません" hideActivity: "アクティビティを非公開にする" hideActivityDescription: "自分のプロフィールのアクティビティ (概要/アクティビティタブ) を他人が見れないようにします。このオプションを有効にしても、自分であればプロフィールのアクティビティタブから引き続き閲覧できます。" channelAnnouncementDescription: "このお知らせはチャンネルのタイムライン上部に表示されます。最初の1行がタイトルとして表示され、2行目以降はお知らせをタップすることで表示されるようになります。" diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index 0ea945da6036..5fa674a7f839 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -103,6 +103,12 @@ export const meta = { id: '05655b05-5a09-47c3-af56-de0c0900791a', }, + cannotScheduleDeleteLaterThanOneYear: { + message: 'Scheduled delete time is later than one year.', + code: 'CANNOT_SCHEDULE_DELETE_LATER_THAN_ONE_YEAR', + id: 'b02b5edb-2741-4841-b692-d9893f1e6515', + }, + noSuchChannel: { message: 'No such channel.', code: 'NO_SUCH_CHANNEL', @@ -375,6 +381,10 @@ export default class extends Endpoint { // eslint- } else if (typeof ps.scheduledDelete.deleteAfter === 'number') { ps.scheduledDelete.deleteAt = Date.now() + ps.scheduledDelete.deleteAfter; } + + if (ps.scheduledDelete.deleteAt && ps.scheduledDelete.deleteAt > Date.now() + ms('1year')) { + throw new ApiError(meta.errors.cannotScheduleDeleteLaterThanOneYear); + } } let channel: MiChannel | null = null; diff --git a/packages/frontend/src/components/MkDeleteScheduleEditor.vue b/packages/frontend/src/components/MkDeleteScheduleEditor.vue index 1b15fbc064ae..3d6d4c4b507b 100644 --- a/packages/frontend/src/components/MkDeleteScheduleEditor.vue +++ b/packages/frontend/src/components/MkDeleteScheduleEditor.vue @@ -4,8 +4,9 @@ SPDX-License-Identifier: AGPL-3.0-only -->