summaryrefslogtreecommitdiff
path: root/packages/frontend/src/widgets
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-03-25 18:31:30 +0900
committerGitHub <noreply@github.com>2024-03-25 18:31:30 +0900
commitf90be427f51392ef3ed5a7eb7f35059274bb47fc (patch)
tree022ebeb3d0a9ee3449cfec9a73307fdb81321ea0 /packages/frontend/src/widgets
parentfix(generator): APIクライアントのパスにoperationIdが使われる... (diff)
downloadmisskey-f90be427f51392ef3ed5a7eb7f35059274bb47fc.tar.gz
misskey-f90be427f51392ef3ed5a7eb7f35059274bb47fc.tar.bz2
misskey-f90be427f51392ef3ed5a7eb7f35059274bb47fc.zip
fix(frontend): 「今日誕生日のフォロー中ユーザー」ウィジェットが正しく動作しない問題を修正 (#12835)
* (fix) タイムゾーンによっては誕生日のフォロー中ユーザーが正しく読み込まれない * 文言をわかりやすく * Update Changelog * (add) reload button * Update CHANGELOG.md * run misskey-js * fix * Revert "文言をわかりやすく" This reverts commit c5ab6419563cc70ec8ba758e800c74d3469131e3. * Update packages/frontend/src/widgets/WidgetBirthdayFollowings.vue * Update packages/frontend/src/widgets/WidgetBirthdayFollowings.vue --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/widgets')
-rw-r--r--packages/frontend/src/widgets/WidgetBirthdayFollowings.vue35
1 files changed, 26 insertions, 9 deletions
diff --git a/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue b/packages/frontend/src/widgets/WidgetBirthdayFollowings.vue
index 5b448e2c3b..49fd103d37 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
<MkContainer :showHeader="widgetProps.showHeader" class="mkw-bdayfollowings">
<template #icon><i class="ti ti-cake"></i></template>
<template #header>{{ i18n.ts._widgets.birthdayFollowings }}</template>
+ <template #func="{ buttonStyleClass }"><button class="_button" :class="buttonStyleClass" @click="actualFetch()"><i class="ti ti-refresh"></i></button></template>
<div :class="$style.bdayFRoot">
<MkLoading v-if="fetching"/>
@@ -53,7 +54,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit,
);
-const users = ref<Misskey.entities.FollowingFolloweePopulated[]>([]);
+const users = ref<Misskey.Endpoints['users/following']['res']>([]);
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,