From f60d9da614d02aeea80fba2c7542d6b1ea600dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:48:54 +0900 Subject: [PATCH 1/7] =?UTF-8?q?chore(frontend):=20=E9=80=9A=E5=A0=B1?= =?UTF-8?q?=E3=81=AE=E3=82=AB=E3=83=86=E3=82=B4=E3=83=AA=E3=81=AE=E8=AA=BF?= =?UTF-8?q?=E6=95=B4=E3=83=BB=E6=8A=95=E7=A8=BF=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=A0=E3=81=AE=E3=82=AC=E3=82=A4=E3=83=89=E3=83=A9=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=B8=E3=81=AE=E5=B0=8E=E7=B7=9A=E3=81=AB=E5=88=A9?= =?UTF-8?q?=E7=94=A8=E8=A6=8F=E7=B4=84=E3=82=82=E8=BF=BD=E5=8A=A0=20(Missk?= =?UTF-8?q?eyIO#902)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en-US.yml | 7 ++++--- locales/index.d.ts | 11 ++++++----- locales/ja-JP.yml | 8 ++++---- locales/ko-KR.yml | 7 ++++--- packages/frontend/src/components/MkPostForm.vue | 10 +++------- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 3ec46cc61b00..00f348cebf64 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1365,8 +1365,8 @@ _abuseReportCategory: otherBreach_description: "Other actions that violate the terms but do not fall under specific categories" violationRights: "Rights Infringement or Impersonation (Reported by Rights Holder)" violationRights_description: "Posts infringing the rights (such as copyright or trademark) of the rights holder or impersonation" - violationRightsOther: "Rights Infringement or Impersonation (Reported by Third Party)" - violationRightsOther_description: "Posts infringing the rights (such as copyright or trademark) of others or impersonation\nIf reported by a third party, cases outside the scope of non-complaint offenses as defined by law may not be addressed" + violationRightsOther: "Rights Infringement (Reported by Third Party)" + violationRightsOther_description: "Posts infringing the rights (such as copyright or trademark) of others\nIf reported by a third party, cases outside the scope of non-complaint offenses as defined by law may not be addressed" notLike: "Dislike This Person" notLike_description: "Users or posts that you find unpleasant for personal reasons" other: "Other" @@ -2324,6 +2324,7 @@ _postForm: d: "What do you want to say?" e: "Start writing..." f: "Waiting for you to write..." + tosAndGuidelinesInfo: "Before posting, please read the [Terms of Service]({tosUrl}) and [NSFW Guidelines](https://go.misskey.io/media-guideline)." _profile: name: "Name" username: "Username" @@ -2348,7 +2349,7 @@ _profile: sectionName: "Section name" sectionNameNoneDescription: "Do not display the section name" sectionNameNone: "Section without name" - policyDisplayLimitExceeded: "The number of items displayed exceeds the current support plan's limit ({max}). This item will not be displayed. You can upgrade your plan [here](https://go.misskey.io/donate)." + policyDisplayLimitExceeded: "The number of items displayed exceeds the current support plan's limit ({max}). This item will not be displayed.\nYou can upgrade your plan [here](https://go.misskey.io/donate)." _exportOrImport: allNotes: "All notes" favoritedNotes: "Favorite notes" diff --git a/locales/index.d.ts b/locales/index.d.ts index 707e058e8e96..757baea2201d 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -5490,11 +5490,11 @@ export interface Locale extends ILocale { */ "violationRights_description": string; /** - * 権利侵害やなりすまし(第三者による通報) + * 権利侵害(第三者による通報) */ "violationRightsOther": string; /** - * 他人の著作権、商標権、またはその他の権利を侵害する投稿及びなりすまし行為 + * 他人の著作権、商標権、またはその他の権利を侵害する行為 * 第三者による通報の場合、法律で定められた非親告罪の範囲外のケースには対応できないことがあります */ "violationRightsOther_description": string; @@ -9068,9 +9068,9 @@ export interface Locale extends ILocale { "f": string; }; /** - * [NSFWガイドライン]({nsfwGuideUrl})を必ずお読みになってからご利用ください。 + * 投稿する前に、[利用規約]({tosUrl})と[NSFWガイドライン](https://go.misskey.io/media-guideline)を必ずお読みください。 */ - "guidelineInfo": ParameterizedString<"nsfwGuideUrl">; + "tosAndGuidelinesInfo": ParameterizedString<"tosUrl">; }; "_profile": { /** @@ -9166,7 +9166,8 @@ export interface Locale extends ILocale { */ "sectionNameNone": string; /** - * 現在の支援プランの表示上限({max}個)を超えているため、この項目は表示されません。[ここ](https://go.misskey.io/donate)からプランをアップグレードできます。 + * 現在の支援プランの表示上限({max}個)を超えているため、この項目は表示されません。 + * [ここ](https://go.misskey.io/donate)からプランをアップグレードできます。 */ "policyDisplayLimitExceeded": ParameterizedString<"max">; }; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 5612736be418..f53803b3a471 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1370,8 +1370,8 @@ _abuseReportCategory: otherBreach_description: "明確に分類されないその他の規約違反行為" violationRights: "権利侵害やなりすまし(侵害を受けた権利者本人によるご申告)" violationRights_description: "権利者本人の著作権、商標権、またはその他の権利を侵害する投稿及びなりすまし行為" - violationRightsOther: "権利侵害やなりすまし(第三者による通報)" - violationRightsOther_description: "他人の著作権、商標権、またはその他の権利を侵害する投稿及びなりすまし行為\n第三者による通報の場合、法律で定められた非親告罪の範囲外のケースには対応できないことがあります" + violationRightsOther: "権利侵害(第三者による通報)" + violationRightsOther_description: "他人の著作権、商標権、またはその他の権利を侵害する行為\n第三者による通報の場合、法律で定められた非親告罪の範囲外のケースには対応できないことがあります" notLike: "この人が気に入らない" notLike_description: "個人的な理由で不快と感じるユーザーや投稿" other: "その他" @@ -2377,7 +2377,7 @@ _postForm: d: "言いたいことは?" e: "ここに書いてください" f: "あなたが書くのを待っています..." - guidelineInfo: "[NSFWガイドライン]({nsfwGuideUrl})を必ずお読みになってからご利用ください。" + tosAndGuidelinesInfo: "投稿する前に、[利用規約]({tosUrl})と[NSFWガイドライン](https://go.misskey.io/media-guideline)を必ずお読みください。" _profile: name: "名前" @@ -2403,7 +2403,7 @@ _profile: sectionName: "セクション名" sectionNameNoneDescription: "セクション名を表示しないようにする" sectionNameNone: "名前が表示されないセクション" - policyDisplayLimitExceeded: "現在の支援プランの表示上限({max}個)を超えているため、この項目は表示されません。[ここ](https://go.misskey.io/donate)からプランをアップグレードできます。" + policyDisplayLimitExceeded: "現在の支援プランの表示上限({max}個)を超えているため、この項目は表示されません。\n[ここ](https://go.misskey.io/donate)からプランをアップグレードできます。" _exportOrImport: allNotes: "全てのノート" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index d90bd9adfa11..d51745adb823 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -1362,8 +1362,8 @@ _abuseReportCategory: otherBreach_description: "명확하게 분류되지 않는 기타 규약 위반 행위" violationRights: "권리 침해 또는 사칭 (권리자 본인에 의한 신고)" violationRights_description: "권리자 본인의 저작권, 상표권 또는 기타 권리를 침해하는 게시물 및 사칭 행위" - violationRightsOther: "권리 침해 또는 사칭 (제3자에 의한 신고)" - violationRightsOther_description: "타인의 저작권, 상표권 또는 기타 권리를 침해하는 게시물 및 사칭 행위\n제3자에 의한 신고의 경우, 법으로 정해진 비친고죄 범위 외의 사례에는 대응할 수 없습니다" + violationRightsOther: "권리 침해 (제3자에 의한 신고)" + violationRightsOther_description: "타인의 저작권, 상표권 또는 기타 권리를 침해하는 행위\n제3자에 의한 신고의 경우, 법으로 정해진 비친고죄 범위 외의 사례에는 대응할 수 없습니다" notLike: "이 사람이 마음에 들지 않음" notLike_description: "개인적인 이유로 불쾌감을 느끼는 사용자나 게시물" other: "기타" @@ -2310,6 +2310,7 @@ _postForm: d: "말하고 싶은 게 있나요?" e: "여기에 적어 주세요" f: "글 쓰기를 기다려요…" + tosAndGuidelinesInfo: "노트를 게시하기 전에 [이용약관]({tosUrl})과 [NSFW 가이드라인](https://go.misskey.io/media-guideline)을 반드시 읽어 주세요." _profile: name: "이름" username: "사용자 이름" @@ -2334,7 +2335,7 @@ _profile: sectionName: "섹션 이름" sectionNameNoneDescription: "섹션 이름이 표시되지 않도록 합니다" sectionNameNone: "이름이 표시되지 않는 섹션" - policyDisplayLimitExceeded: "현재 지원 플랜의 표시 제한({max}개)을 초과하였기 때문에 이 항목은 표시되지 않습니다. [여기](https://go.misskey.io/donate)에서 플랜을 업그레이드할 수 있습니다." + policyDisplayLimitExceeded: "현재 지원 플랜의 표시 제한({max}개)을 초과하였기 때문에 이 항목은 표시되지 않습니다.\n[여기](https://go.misskey.io/donate)에서 플랜을 업그레이드할 수 있습니다." _exportOrImport: allNotes: "모든 노트" favoritedNotes: "즐겨찾기한 노트" diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index ddf4a157def0..878958da5321 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -86,7 +86,9 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.tsx.willBePostedAt({ x: dateTimeFormat.format(scheduledTime) }) }} - + + + @@ -228,8 +230,6 @@ const imeText = ref(''); const showingOptions = ref(false); const textAreaReadOnly = ref(false); -const nsfwGuideUrl = 'https://go.misskey.io/media-guideline'; - const draftKey = computed((): string => { let key = channel.value ? `channel:${channel.value.id}` : ''; @@ -1443,10 +1443,6 @@ defineExpose({ color: var(--accent); } -.guidelineInfo { - margin-top: 8px; -} - @container (max-width: 500px) { .headerRight { font-size: .9em; From 71c2921b9d940adbd0a3532a1e36a1e8a6a7b682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:49:16 +0900 Subject: [PATCH 2/7] =?UTF-8?q?fix(backend/SigninApiService):=20=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=AE=E3=83=AC=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=83=9F=E3=83=83=E3=83=88=E6=99=82=E3=80=81=E6=84=8F?= =?UTF-8?q?=E5=9B=B3=E3=81=97=E3=81=9F=E3=82=82=E3=81=AE=E3=81=A8=E9=81=95?= =?UTF-8?q?=E3=81=86=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=8F=AF=E8=83=BD=E6=80=A7=E3=81=8C=E3=81=82=E3=82=8B?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=20(MisskeyIO#903)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/api/SigninApiService.ts | 11 ++++++++--- packages/frontend/src/os.ts | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/server/api/SigninApiService.ts b/packages/backend/src/server/api/SigninApiService.ts index a56a2d85b6e8..5f264bb73387 100644 --- a/packages/backend/src/server/api/SigninApiService.ts +++ b/packages/backend/src/server/api/SigninApiService.ts @@ -97,10 +97,15 @@ export class SigninApiService { reply.code(429); return { error: { - message: 'Too many failed attempts to sign in. Try again later.', - code: 'TOO_MANY_AUTHENTICATION_FAILURES', + message: 'Rate limit exceeded. Please try again later.', + code: 'RATE_LIMIT_EXCEEDED', id: '22d05606-fbcf-421a-a2db-b32610dcfd1b', - }, + info: { + message: 'Too many failed attempts to sign in.', + code: 'TOO_MANY_AUTHENTICATION_FAILURES', + id: '6c181469-ecb9-42d2-82c9-60db5486a819', + }, + } }; } diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts index 9a5243926808..5a1071a926cf 100644 --- a/packages/frontend/src/os.ts +++ b/packages/frontend/src/os.ts @@ -79,7 +79,7 @@ export async function apiErrorHandler(err: Misskey.api.APIError, endpoint?: stri } else if (err.code === 'ROLE_PERMISSION_DENIED') { title = i18n.ts.permissionDeniedError; text = i18n.ts.permissionDeniedErrorDescription; - } else if (err.code?.startsWith('TOO_MANY')) { + } else if (err.code?.startsWith('TOO_MANY_')) { title = i18n.ts.youCannotCreateAnymore; text = `${i18n.ts.error}: ${err.id}`; } From 655ed957bc2bd55add54cea1b7eb3572ef4d5234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:49:42 +0900 Subject: [PATCH 3/7] =?UTF-8?q?enhance(ux/frontend/MkPostForm):=20?= =?UTF-8?q?=E4=BA=88=E7=B4=84=E6=8A=95=E7=A8=BF=E3=81=AE=E6=99=82=E9=96=93?= =?UTF-8?q?=E3=82=92=E5=86=8D=E5=BA=A6=E8=A8=AD=E5=AE=9A=E3=81=99=E3=82=8B?= =?UTF-8?q?=E6=99=82=E3=80=81=E4=BB=A5=E5=89=8D=E8=A8=AD=E5=AE=9A=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=99=82=E9=96=93=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(MisskeyIO#904)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/frontend/src/components/MkPostForm.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 878958da5321..8ec021d87267 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -597,6 +597,7 @@ function removeVisibleUser(user) { async function setScheduledTime() { const { canceled, result: date } = await os.inputDateTime({ title: i18n.ts.setScheduledTime, + default: scheduledTime.value ?? undefined, }); if (canceled) return; From f0f86f1121bae5a2c66daa17bbad73582d604d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:50:01 +0900 Subject: [PATCH 4/7] =?UTF-8?q?spec(backend/queue/ScheduledNote):=20?= =?UTF-8?q?=E4=BA=88=E7=B4=84=E6=99=82=E9=96=93=E3=81=8C=E9=81=8E=E3=81=8E?= =?UTF-8?q?=E3=82=8B=E5=89=8D=E3=81=AB=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(MisskeyIO#905)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../processors/CheckMissingScheduledNoteProcessorService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/queue/processors/CheckMissingScheduledNoteProcessorService.ts b/packages/backend/src/queue/processors/CheckMissingScheduledNoteProcessorService.ts index 8c441a9cc4a7..c55eaa40fe1a 100644 --- a/packages/backend/src/queue/processors/CheckMissingScheduledNoteProcessorService.ts +++ b/packages/backend/src/queue/processors/CheckMissingScheduledNoteProcessorService.ts @@ -37,7 +37,7 @@ export class CheckMissingScheduledNoteProcessorService { } const query = this.scheduledNotesRepository.createQueryBuilder('draft') - .where('draft.scheduledAt < now() - interval \'5 minutes\'').orderBy('draft.createdAt', 'ASC'); + .where('draft.scheduledAt < now() + interval \'10 minutes\'').orderBy('draft.createdAt', 'ASC'); let lastId = '0'; while (true) { From 8821e3e81bd859c23457614be21d9ae1c1c6ce6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:08:13 +0900 Subject: [PATCH 5/7] =?UTF-8?q?spec(role/ScheduledNote):=20=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=81=A7=E4=BA=88=E7=B4=84=E6=8A=95=E7=A8=BF?= =?UTF-8?q?=E3=81=AE=E5=80=8B=E6=95=B0=E3=83=BB=E4=BA=88=E7=B4=84=E3=81=AE?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=E6=97=A5=E6=95=B0=E3=82=92=E5=88=B6=E5=BE=A1?= =?UTF-8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(Missk?= =?UTF-8?q?eyIO#906)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en-US.yml | 3 ++ locales/index.d.ts | 13 +++++++ locales/ja-JP.yml | 3 ++ locales/ko-KR.yml | 3 ++ .../backend/src/core/NoteCreateService.ts | 9 +++++ packages/backend/src/core/RoleService.ts | 6 +++ .../backend/src/models/json-schema/role.ts | 8 ++++ .../src/server/api/endpoints/notes/create.ts | 35 +++++++++-------- .../frontend/src/components/MkPostForm.vue | 35 +++++++++++++---- packages/frontend/src/const.ts | 2 + .../frontend/src/pages/admin/roles.editor.vue | 38 +++++++++++++++++++ packages/frontend/src/pages/admin/roles.vue | 14 +++++++ packages/misskey-js/src/autogen/types.ts | 2 + 13 files changed, 148 insertions(+), 23 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 00f348cebf64..2117fb056eed 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1794,6 +1794,8 @@ _role: ltlAvailable: "Can view the local timeline" canPublicNote: "Can send public notes" canScheduleNote: "Can schedule notes" + scheduleNoteLimit: "Maximum number of scheduled notes" + scheduleNoteMaxDays: "Maximum number of days that note can be scheduled" canInitiateConversation: "Can mention, reply or quote" canCreateContent: "Can create contents" canUpdateContent: "Can edit contents" @@ -2324,6 +2326,7 @@ _postForm: d: "What do you want to say?" e: "Start writing..." f: "Waiting for you to write..." + policyScheduleNoteMaxDaysExceeded: "The maximum number of days you can schedule notes for with your current support plan is {max}.\nYou can upgrade your plan [here](https://go.misskey.io/donate)." tosAndGuidelinesInfo: "Before posting, please read the [Terms of Service]({tosUrl}) and [NSFW Guidelines](https://go.misskey.io/media-guideline)." _profile: name: "Name" diff --git a/locales/index.d.ts b/locales/index.d.ts index 757baea2201d..dce1d15b8015 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -7019,6 +7019,14 @@ export interface Locale extends ILocale { * 予約投稿の許可 */ "canScheduleNote": string; + /** + * 予約投稿の最大数 + */ + "scheduleNoteLimit": string; + /** + * 予約投稿の最大日数 + */ + "scheduleNoteMaxDays": string; /** * メンション、リプライ、引用の許可 */ @@ -9067,6 +9075,11 @@ export interface Locale extends ILocale { */ "f": string; }; + /** + * 現在の支援プランで予約できる日数の上限は{max}日です。 + * [ここ](https://go.misskey.io/donate)からプランをアップグレードできます。 + */ + "policyScheduleNoteMaxDaysExceeded": ParameterizedString<"max">; /** * 投稿する前に、[利用規約]({tosUrl})と[NSFWガイドライン](https://go.misskey.io/media-guideline)を必ずお読みください。 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f53803b3a471..e5038ead054b 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1808,6 +1808,8 @@ _role: ltlAvailable: "ローカルタイムラインの閲覧" canPublicNote: "パブリック投稿の許可" canScheduleNote: "予約投稿の許可" + scheduleNoteLimit: "予約投稿の最大数" + scheduleNoteMaxDays: "予約投稿の最大日数" canInitiateConversation: "メンション、リプライ、引用の許可" canCreateContent: "コンテンツの作成" canUpdateContent: "コンテンツの編集" @@ -2377,6 +2379,7 @@ _postForm: d: "言いたいことは?" e: "ここに書いてください" f: "あなたが書くのを待っています..." + policyScheduleNoteMaxDaysExceeded: "現在の支援プランで予約できる日数の上限は{max}日です。\n[ここ](https://go.misskey.io/donate)からプランをアップグレードできます。" tosAndGuidelinesInfo: "投稿する前に、[利用規約]({tosUrl})と[NSFWガイドライン](https://go.misskey.io/media-guideline)を必ずお読みください。" _profile: diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index d51745adb823..6bc34827ae40 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -1791,6 +1791,8 @@ _role: ltlAvailable: "로컬 타임라인 보이기" canPublicNote: "공개 노트 허용" canScheduleNote: "노트 예약 허용" + scheduleNoteLimit: "노트 예약 한도" + scheduleNoteMaxDays: "노트 예약 최대 일수" mentionMax: "노트에 넣을 수 있는 멘션 수" canCreateContent: "컨텐츠 생성 허용" canUpdateContent: "컨텐츠 수정 허용" @@ -2310,6 +2312,7 @@ _postForm: d: "말하고 싶은 게 있나요?" e: "여기에 적어 주세요" f: "글 쓰기를 기다려요…" + policyScheduleNoteMaxDaysExceeded: "현재 지원 플랜의 예약 가능한 최대 일수는 {max}일입니다.\n[여기](https://go.misskey.io/donate)에서 플랜을 업그레이드할 수 있습니다." tosAndGuidelinesInfo: "노트를 게시하기 전에 [이용약관]({tosUrl})과 [NSFW 가이드라인](https://go.misskey.io/media-guideline)을 반드시 읽어 주세요." _profile: name: "이름" diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 71e430c2d4a9..8a43e100d9f9 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -425,6 +425,15 @@ export class NoteCreateService implements OnApplicationShutdown { throw new IdentifiableError('7cc42034-f7ab-4f7c-87b4-e00854479080', 'User has no permission to schedule notes.'); } + if ((data.scheduledAt.getTime() - Date.now()) / 86_400_000 > policies.scheduleNoteMaxDays) { + throw new IdentifiableError('506006cf-3092-4ae1-8145-b025001c591f', `User can schedule notes up to ${policies.scheduleNoteMaxDays} days in the future.`); + } + + const scheduledCount = await this.scheduledNotesRepository.countBy({ userId: user.id }); + if (scheduledCount >= policies.scheduleNoteLimit) { + throw new IdentifiableError('7fc78d25-d947-45c1-9547-02257b98cab3', `User can schedule up to ${policies.scheduleNoteLimit} notes.`); + } + const draft = await this.insertScheduledNote(user, data); await this.queueService.createScheduledNoteJob(draft.id, draft.scheduledAt!); diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index 1b8091cc24c7..60c935887fc4 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -37,6 +37,8 @@ export type RolePolicies = { ltlAvailable: boolean; canPublicNote: boolean; canScheduleNote: boolean; + scheduleNoteLimit: number; + scheduleNoteMaxDays: number; canInitiateConversation: boolean; canCreateContent: boolean; canUpdateContent: boolean; @@ -79,6 +81,8 @@ export const DEFAULT_POLICIES: RolePolicies = { ltlAvailable: true, canPublicNote: true, canScheduleNote: true, + scheduleNoteLimit: 10, + scheduleNoteMaxDays: 365, canInitiateConversation: true, canCreateContent: true, canUpdateContent: true, @@ -392,6 +396,8 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit { ltlAvailable: calc('ltlAvailable', vs => vs.some(v => v === true)), canPublicNote: calc('canPublicNote', vs => vs.some(v => v === true)), canScheduleNote: calc('canScheduleNote', vs => vs.some(v => v === true)), + scheduleNoteLimit: calc('scheduleNoteLimit', vs => Math.max(...vs)), + scheduleNoteMaxDays: calc('scheduleNoteMaxDays', vs => Math.max(...vs)), canInitiateConversation: calc('canInitiateConversation', vs => vs.some(v => v === true)), canCreateContent: calc('canCreateContent', vs => vs.some(v => v === true)), canUpdateContent: calc('canUpdateContent', vs => vs.some(v => v === true)), diff --git a/packages/backend/src/models/json-schema/role.ts b/packages/backend/src/models/json-schema/role.ts index 6cbea17089ca..69b68c41499c 100644 --- a/packages/backend/src/models/json-schema/role.ts +++ b/packages/backend/src/models/json-schema/role.ts @@ -184,6 +184,14 @@ export const packedRolePoliciesSchema = { type: 'boolean', optional: false, nullable: false, }, + scheduleNoteLimit: { + type: 'integer', + optional: false, nullable: false, + }, + scheduleNoteMaxDays: { + type: 'integer', + optional: false, nullable: false, + }, canInitiateConversation: { type: 'boolean', optional: false, nullable: false, diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index c90c9daf9675..ddccbdae5f9c 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -155,18 +155,26 @@ export const meta = { id: 'e577d185-8179-4a17-b47f-6093985558e6', }, - cannotScheduleToFarFuture: { - message: 'Cannot schedule to the far future.', - code: 'CANNOT_SCHEDULE_TO_FAR_FUTURE', - id: 'ea102856-e8da-4ae9-a98a-0326821bd177', - }, - cannotScheduleSameTime: { message: 'Cannot schedule multiple notes at the same time.', code: 'CANNOT_SCHEDULE_SAME_TIME', id: '187a8fab-fd83-4ae6-a46c-0f6f07784634', }, + tooManyScheduledNotes: { + message: 'You cannot schedule notes any more.', + code: 'TOO_MANY_SCHEDULED_NOTES', + kind: 'permission', + id: '9e33041f-f6fb-414d-98c1-591466e55287' + }, + + cannotScheduleToFarFuture: { + message: 'Cannot schedule to the far future.', + code: 'CANNOT_SCHEDULE_TO_FAR_FUTURE', + kind: 'permission', + id: 'ea102856-e8da-4ae9-a98a-0326821bd177', + }, + rolePermissionDenied: { message: 'You are not assigned to a required role.', code: 'ROLE_PERMISSION_DENIED', @@ -462,11 +470,6 @@ export default class extends Endpoint { // eslint- logger.error('Cannot schedule to the past.', { scheduledAt }); throw new ApiError(meta.errors.cannotScheduleToPast); } - - if (scheduledAt.getTime() - now.getTime() > ms('1year')) { - logger.error('Cannot schedule to the far future.', { scheduledAt }); - throw new ApiError(meta.errors.cannotScheduleToFarFuture); - } } // 投稿を作成 @@ -517,10 +520,12 @@ export default class extends Endpoint { // eslint- logger.error('Failed to create a note.', { error: err }); if (err instanceof IdentifiableError) { - if (err.id === '689ee33f-f97c-479a-ac49-1b9f8140af99') throw new ApiError(meta.errors.containsProhibitedWords); - if (err.id === '9f466dab-c856-48cd-9e65-ff90ff750580') throw new ApiError(meta.errors.containsTooManyMentions); - if (err.id === '7cc42034-f7ab-4f7c-87b4-e00854479080') throw new ApiError(meta.errors.rolePermissionDenied); - if (err.id === '5ea8e4f5-9d64-4e6c-92b8-9e2b5a4756bc') throw new ApiError(meta.errors.cannotScheduleSameTime); + if (err.id === '689ee33f-f97c-479a-ac49-1b9f8140af99') throw new ApiError(meta.errors.containsProhibitedWords, { message: err.message }); + if (err.id === '9f466dab-c856-48cd-9e65-ff90ff750580') throw new ApiError(meta.errors.containsTooManyMentions, { message: err.message }); + if (err.id === '5ea8e4f5-9d64-4e6c-92b8-9e2b5a4756bc') throw new ApiError(meta.errors.cannotScheduleSameTime, { message: err.message }); + if (err.id === '7fc78d25-d947-45c1-9547-02257b98cab3') throw new ApiError(meta.errors.tooManyScheduledNotes, { message: err.message }); + if (err.id === '506006cf-3092-4ae1-8145-b025001c591f') throw new ApiError(meta.errors.cannotScheduleToFarFuture, { message: err.message }); + if (err.id === '7cc42034-f7ab-4f7c-87b4-e00854479080') throw new ApiError(meta.errors.rolePermissionDenied, { message: err.message }); } throw err; diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue index 8ec021d87267..baca7f9f5c8d 100644 --- a/packages/frontend/src/components/MkPostForm.vue +++ b/packages/frontend/src/components/MkPostForm.vue @@ -82,8 +82,18 @@ SPDX-License-Identifier: AGPL-3.0-only - - {{ i18n.tsx.willBePostedAt({ x: dateTimeFormat.format(scheduledTime) }) }} + + + + + {{ i18n.tsx.willBePostedAt({ x: dateTimeFormat.format(scheduledTime) }) }} + + + + + + + @@ -219,6 +229,9 @@ if (props.initialVisibleUsers) { } const reactionAcceptance = ref(defaultStore.state.reactionAcceptance); const scheduledTime = ref(null); +const scheduledTimeExceededPolicy = computed(() => + scheduledTime.value ? (scheduledTime.value.getTime() - Date.now()) / 86_400_000 > $i!.policies.scheduleNoteMaxDays : false +); const autocompleteTextareaInput = ref(null); const autocompleteCwInput = ref(null); const autocompleteHashtagsInput = ref(null); @@ -285,16 +298,20 @@ const maxTextLength = computed((): number => { }); const canPost = computed((): boolean => { - return !props.mock && !posting.value && !posted.value && - ( + return !props.mock + && !posting.value + && !posted.value + && ( 1 <= textLength.value || 1 <= files.value.length || poll.value != null || renote.value != null || (reply.value != null && quoteId.value != null) - ) && - (textLength.value <= maxTextLength.value) && - (!poll.value || poll.value.choices.length >= 2); + ) + && (textLength.value <= maxTextLength.value) + && (!poll.value || poll.value.choices.length >= 2) + && !scheduledTimeExceededPolicy.value + ; }); const withHashtags = computed(defaultStore.makeGetterSetter('postFormWithHashtags')); @@ -1393,8 +1410,10 @@ defineExpose({ .scheduledTime { display: flex; - padding: 8px 24px; + padding: 8px 12px; gap: 4px; + align-items: center; + font-size: 90%; background: var(--infoBg); } diff --git a/packages/frontend/src/const.ts b/packages/frontend/src/const.ts index 1483b9d0c094..e84958a69be8 100644 --- a/packages/frontend/src/const.ts +++ b/packages/frontend/src/const.ts @@ -79,6 +79,8 @@ export const ROLE_POLICIES = [ 'ltlAvailable', 'canPublicNote', 'canScheduleNote', + 'scheduleNoteLimit', + 'scheduleNoteMaxDays', 'canInitiateConversation', 'canCreateContent', 'canUpdateContent', diff --git a/packages/frontend/src/pages/admin/roles.editor.vue b/packages/frontend/src/pages/admin/roles.editor.vue index d4d5b50500ca..f40d1b742472 100644 --- a/packages/frontend/src/pages/admin/roles.editor.vue +++ b/packages/frontend/src/pages/admin/roles.editor.vue @@ -185,6 +185,44 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.scheduleNoteLimit }} + + {{ i18n.ts._role.useBaseValue }} + {{ role.policies.scheduleNoteLimit.value }} + + + + + {{ i18n.ts._role.useBaseValue }} + + + + + {{ i18n.ts._role.priority }} + + + + + + {{ i18n.ts._role._options.scheduleNoteMaxDays }} + + {{ i18n.ts._role.useBaseValue }} + {{ role.policies.scheduleNoteMaxDays.value }} + + + + + {{ i18n.ts._role.useBaseValue }} + + + + + {{ i18n.ts._role.priority }} + + + + {{ i18n.ts._role._options.canInitiateConversation }} diff --git a/packages/frontend/src/pages/admin/roles.vue b/packages/frontend/src/pages/admin/roles.vue index 132ecbd31b32..406da663c96c 100644 --- a/packages/frontend/src/pages/admin/roles.vue +++ b/packages/frontend/src/pages/admin/roles.vue @@ -56,6 +56,20 @@ SPDX-License-Identifier: AGPL-3.0-only + + {{ i18n.ts._role._options.scheduleNoteLimit }} + {{ policies.scheduleNoteLimit }} + + + + + + {{ i18n.ts._role._options.scheduleNoteMaxDays }} + {{ policies.scheduleNoteMaxDays }} + + + + {{ i18n.ts._role._options.canInitiateConversation }} {{ policies.canInitiateConversation ? i18n.ts.yes : i18n.ts.no }} diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index b0d2d76627ae..9990683c8828 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -5078,6 +5078,8 @@ export type components = { ltlAvailable: boolean; canPublicNote: boolean; canScheduleNote: boolean; + scheduleNoteLimit: number; + scheduleNoteMaxDays: number; canInitiateConversation: boolean; canCreateContent: boolean; canUpdateContent: boolean; From c4fafbdca7076d7be3c34aa77608a4a391c1784d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 18:35:08 +0900 Subject: [PATCH 6/7] =?UTF-8?q?perf(stream):=20=E5=BF=85=E8=A6=81=E3=81=AE?= =?UTF-8?q?=E3=81=AA=E3=81=84=E6=97=A2=E8=AA=AD=E5=87=A6=E7=90=86=E3=81=AE?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81=8C=E7=99=BA?= =?UTF-8?q?=E7=94=9F=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=20(MisskeyIO#907)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/server/api/stream/channels/antenna.ts | 5 ++++- .../src/server/api/stream/channels/channel.ts | 5 ++++- .../server/api/stream/channels/global-timeline.ts | 5 ++++- .../src/server/api/stream/channels/hashtag.ts | 4 +++- .../src/server/api/stream/channels/home-timeline.ts | 5 ++++- .../server/api/stream/channels/hybrid-timeline.ts | 5 ++++- .../src/server/api/stream/channels/local-timeline.ts | 5 ++++- .../backend/src/server/api/stream/channels/main.ts | 12 ++++++++++-- .../src/server/api/stream/channels/role-timeline.ts | 5 ++++- .../src/server/api/stream/channels/user-list.ts | 5 ++++- packages/frontend/src/scripts/use-note-capture.ts | 7 +++++-- 11 files changed, 50 insertions(+), 13 deletions(-) diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts index ff05359b5939..f47a644de527 100644 --- a/packages/backend/src/server/api/stream/channels/antenna.ts +++ b/packages/backend/src/server/api/stream/channels/antenna.ts @@ -51,6 +51,10 @@ class AntennaChannel extends Channel { if (this.isNoteMutedOrBlocked(note)) return; + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -59,7 +63,6 @@ class AntennaChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } else { diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 96ada8c97df1..7ebc2ed56fa4 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -57,6 +57,10 @@ class ChannelChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -65,7 +69,6 @@ class ChannelChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 5816187401f4..371449cfdaf9 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -87,6 +87,10 @@ class GlobalTimelineChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -95,7 +99,6 @@ class GlobalTimelineChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts index c7384fdf96e0..0dbd70b99f01 100644 --- a/packages/backend/src/server/api/stream/channels/hashtag.ts +++ b/packages/backend/src/server/api/stream/channels/hashtag.ts @@ -60,7 +60,9 @@ class HashtagChannel extends Channel { } } - this.connection.cacheNote(note); + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } this.send('note', note); } diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts index 34890854c3de..7b38cb59c3fa 100644 --- a/packages/backend/src/server/api/stream/channels/home-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts @@ -91,6 +91,10 @@ class HomeTimelineChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -99,7 +103,6 @@ class HomeTimelineChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 47d534aa1a93..4103fb5dc499 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -105,6 +105,10 @@ class HybridTimelineChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -113,7 +117,6 @@ class HybridTimelineChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index e2192cfad221..99d94ace9ad0 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -90,6 +90,10 @@ class LocalTimelineChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -98,7 +102,6 @@ class LocalTimelineChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts index f93f625681bf..b7f840c6c3d0 100644 --- a/packages/backend/src/server/api/stream/channels/main.ts +++ b/packages/backend/src/server/api/stream/channels/main.ts @@ -38,7 +38,11 @@ class MainChannel extends Channel { const note = await this.noteEntityService.pack(data.body.note.id, this.user, { detail: true, }); - this.connection.cacheNote(note); + + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + data.body.note = note; } break; @@ -51,7 +55,11 @@ class MainChannel extends Channel { const note = await this.noteEntityService.pack(data.body.id, this.user, { detail: true, }); - this.connection.cacheNote(note); + + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + data.body = note; } break; diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts index 67e5cd138f3e..b735507e24a5 100644 --- a/packages/backend/src/server/api/stream/channels/role-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts @@ -73,6 +73,10 @@ class RoleTimelineChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -81,7 +85,6 @@ class RoleTimelineChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } else { diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index d9407ac5dd59..4b8df4368f6d 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -130,6 +130,10 @@ class UserListChannel extends Channel { } } + if (this.user && (note.visibleUserIds?.includes(this.user.id) ?? note.mentions?.includes(this.user.id))) { + this.connection.cacheNote(note); + } + if (this.minimize && ['public', 'home'].includes(note.visibility)) { this.send('note', { id: note.id, myReaction: note.myReaction, @@ -138,7 +142,6 @@ class UserListChannel extends Channel { renote: note.renote?.myReaction ? { myReaction: note.renote.myReaction } : undefined, }); } else { - this.connection.cacheNote(note); this.send('note', note); } } diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts index 542d8ab52b18..db21dcba199d 100644 --- a/packages/frontend/src/scripts/use-note-capture.ts +++ b/packages/frontend/src/scripts/use-note-capture.ts @@ -60,6 +60,8 @@ export function useNoteCapture(props: { } case 'pollVoted': { + if (note.value.poll == null) return; + const choice = body.choice; const choices = [...note.value.poll.choices]; @@ -84,8 +86,9 @@ export function useNoteCapture(props: { function capture(withHandler = false): void { if (connection) { - // TODO: このノートがストリーミング経由で流れてきた場合のみ sr する - connection.send(document.body.contains(props.rootEl.value ?? null as Node | null) ? 'sr' : 's', { id: note.value.id }); + if ($i && (note.value?.visibleUserIds?.includes($i.id) ?? note.value?.mentions?.includes($i.id))) { + connection.send(document.body.contains(props.rootEl.value ?? null as Node | null) ? 'sr' : 's', { id: note.value.id }); + } if (pureNote.value.id !== note.value.id) connection.send('s', { id: pureNote.value.id }); if (withHandler) connection.on('noteUpdated', onStreamNoteUpdated); } From 428ff56abe33c75c618d7445210ce159db397733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Fri, 17 Jan 2025 18:35:28 +0900 Subject: [PATCH 7/7] Bump up version to 2024.5.0-io.7c (MisskeyIO#908) --- package.json | 2 +- packages/misskey-js/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b7029ddac900..bdd052f60d9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.5.0-io.7b", + "version": "2024.5.0-io.7c", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/misskey-js/package.json b/packages/misskey-js/package.json index b9aaa1ad6624..7add6a115869 100644 --- a/packages/misskey-js/package.json +++ b/packages/misskey-js/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "misskey-js", - "version": "2024.5.0-io.7b", + "version": "2024.5.0-io.7c", "description": "Misskey SDK for JavaScript", "types": "./built/dts/index.d.ts", "exports": {