diff --git a/CHANGELOG.md b/CHANGELOG.md index d90b1425c13d..f41ff2171f1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - 実装の都合により、プラグインは1つエラーを起こした時に即時停止するようになりました - Enhance: ページのデザインを変更 - Enhance: 2要素認証(ワンタイムパスワード)の入力欄を改善 +- Enhance: 「今日誕生日のフォロー中ユーザー」ウィジェットを手動でリロードできるように - Fix: 一部のページ内リンクが正しく動作しない問題を修正 - Fix: 周年の実績が閏年を考慮しない問題を修正 - Fix: ローカルURLのプレビューポップアップが左上に表示される @@ -27,6 +28,7 @@ (Cherry-picked from https://github.com/MisskeyIO/misskey/pull/528) - Fix: コードブロックのシンタックスハイライトで使用される定義ファイルをCDNから取得するように #13177 - CDNから取得せずMisskey本体にバンドルする場合は`pacakges/frontend/vite.config.ts`を修正してください。 +- Fix: タイムゾーンによっては、「今日誕生日のフォロー中ユーザー」ウィジェットが正しく動作しない問題を修正 ### Server - Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 5d52ebba7660..6b3389f0b242 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -6,6 +6,7 @@ import { IsNull } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository, FollowingsRepository, UserProfilesRepository } from '@/models/_.js'; +import { birthdaySchema } from '@/models/User.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { QueryService } from '@/core/QueryService.js'; import { FollowingEntityService } from '@/core/entities/FollowingEntityService.js'; @@ -66,7 +67,7 @@ export const paramDef = { description: 'The local host is represented with `null`.', }, - birthday: { type: 'string', nullable: true }, + birthday: { ...birthdaySchema, nullable: true }, }, anyOf: [ { required: ['userId'] }, @@ -127,9 +128,7 @@ export default class extends Endpoint { // eslint- if (ps.birthday) { try { - const d = new Date(ps.birthday); - d.setHours(0, 0, 0, 0); - const birthday = `${(d.getMonth() + 1).toString().padStart(2, '0')}-${d.getDate().toString().padStart(2, '0')}`; + const birthday = ps.birthday.substring(5, 10); const birthdayUserQuery = this.userProfilesRepository.createQueryBuilder('user_profile'); birthdayUserQuery.select('user_profile.userId') .where(`SUBSTR(user_profile.birthday, 6, 5) = '${birthday}'`); diff --git a/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue b/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue index 5b448e2c3bed..49fd103d37eb 100644 --- a/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue +++ b/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue @@ -7,6 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only +
@@ -53,7 +54,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name, emit, ); -const users = ref([]); +const users = ref([]); const fetching = ref(true); let lastFetchedAt = '1970-01-01'; @@ -70,19 +71,35 @@ const fetch = () => { now.setHours(0, 0, 0, 0); if (now > lfAtD) { - misskeyApi('users/following', { - limit: 18, - birthday: now.toISOString(), - userId: $i.id, - }).then(res => { - users.value = res; - fetching.value = false; - }); + actualFetch(); lastFetchedAt = now.toISOString(); } }; +function actualFetch() { + if ($i == null) { + users.value = []; + fetching.value = false; + return; + } + + const now = new Date(); + now.setHours(0, 0, 0, 0); + fetching.value = true; + misskeyApi('users/following', { + limit: 18, + birthday: `${now.getFullYear().toString().padStart(4, '0')}-${(now.getMonth() + 1).toString().padStart(2, '0')}-${now.getDate().toString().padStart(2, '0')}`, + userId: $i.id, + }).then(res => { + users.value = res; + window.setTimeout(() => { + // 早すぎるとチカチカする + fetching.value = false; + }, 100); + }); +} + useInterval(fetch, 1000 * 60, { immediate: true, afterMounted: true,